I have registered a domain, example.eu (I haven't but let's assume that for a moment). I have set up a wildcard support on a webserver so all requests for any resource in any of subdomains are handeled by the same DOCUMENT_ROOT.
-----
DOCUMENT_ROOT
+ .htaccess
+ blog-files/
+ doku/
\ wiki-files/
\ robots.txt
-----
I would like to have a wiki and a blog, available as wiki.example.eu and blog.example.eu, respectively. So I've installed DW in DOCUMENT_ROOT/doku and created .htaccess like this:
-----
RewriteCond %{HTTP_HOST} !=wiki.example.eu
RewriteRule .* - [S=3]
# let's ommit al the _media, _export stuff for the sake of simplicity
# some static files, eg.
http://wiki.example.eu/robots.txt
RewriteCond %{DOCUMENT_ROOT}/wiki-files/%{REQUEST_URI} -f
RewriteRule (.*) /wiki-files/$1 [L]
RewriteRule ^$ /doku/doku.php?id=wiki/start [L]
RewriteRule (.*) /doku/doku.php?id=wiki/$1 [L]
RewriteCond %{HTTP_HOST} !=blog.example.eu
RewriteRule .* - [S=3]
RewriteCond %{DOCUMENT_ROOT}/wiki-files/%{REQUEST_URI} -f
RewriteRule (.*) /blog-files/$1 [L]
RewriteRule ^$ /doku/doku.php?id=blog/start
RewriteRule (.*) /doku/doku.php?id=blog/$1
-----
With a setup like this
http://blog.example.eu/2011-08-21/a_post becomes
http://blog.example.eu/doku/doku.php?id=2011-08-21/a_post and
http://wiki.example.eu/ is in fact
http://wiki.example.eu/doku/doku.php?id=wiki/start. In the local.php file I set different configuration values (template etc.) depending on $_SERVER['HTTP_HOST']
-----BEGIN FEATURE REQUEST-----
I would like DokuWiki to offer yet another 'userewrite' option (let's call it 1a, because IMHO it requires .htaccess) that could use some kind of association between values of HTTP_HOST and namespaces (basens for each known HTTP_HOST?) and would provide links with the chosen namespace stripped. This applied to _media, _detail and _export too.
-----END FEATURE REQUEST-----
I've tried to frob basedir but it occurs that it introduces problems with "support" scripts (eg. css.php, fetch.php) still need to be accessed as
http://wiki.example.eu/doku/lib/exe/css.php.