Revision [6833]
This is an old revision of ModrewriteInSubdirectoryWorkaround made by JavaWoman on 2005-03-22 06:57:44.
Mod_rewrite with Wikka in subdirectory doesn't work
See also: ModRewrite
Symptoms
Wikka is installed in a subdirectory - like http://example.com/wiki/ - and rewriting as defined in .htaccess doesn't work: the paths aren't correct.Cause
If the path to the subdirectory is the same as the document root plus the subdirectory, the translation should work fine. However, if some kind of aliasing is taking place (as may be the case with hosted sites, though that is not the only possibility) then Apache won't be able to construct the correct URL without a little help.Applies to
All Wikka versionsNote
Future versions of Wikka (> 1.1.6.0) may handle the workaround outlined below automatically.Solution
Use the RewriteBase directive to tell Apache what the URL is for the directory the .htaccess file is in. So for the .htaccess file in the wiki subdirectory which has (starting with line 7):- <IfModule mod_rewrite.c>
- RewriteEngine on
- RewriteCond %{REQUEST_FILENAME} -d
- RewriteRule ^(.*/[^\./]*[^/])$ $1/
- RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L]
- </IfModule>
- <IfModule mod_rewrite.c>
- RewriteEngine on
- RewriteBase /wiki
- RewriteCond %{REQUEST_FILENAME} -d
- RewriteRule ^(.*/[^\./]*[^/])$ $1/
- RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L]
- </IfModule>
If you would rather add it to your Apache configuration file (httpd.conf), instead of .htaccess, you need to enclose it in a <Directory> and not use the RewriteBase directive:
<Directory /usr/local/www/data/wiki>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*/[^\./]*[^/])$ $1/
RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L]
</Directory>
where the path /usr/local/www/data/wiki corresponds to the absolute server path where your Wikka is installed (change to match your configuration).RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*/[^\./]*[^/])$ $1/
RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L]
</Directory>
CategoryWorkaround