Revision [5980]

This is an old revision of ModrewriteInSubdirectoryWorkaround made by JavaWoman on 2005-02-15 07:27:41.

 

Mod_rewrite with Wikka installed in subdirectory


Symptoms

Wikka is installed in a subdirectory - like http://example.com/wiki/ - and rewriting as defined in .htaccess doesn't work.

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 versions
Note
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):
  1. <IfModule mod_rewrite.c>
  2.  RewriteEngine on
  3.  RewriteCond %{REQUEST_FILENAME} -d
  4.  RewriteRule ^(.*/[^\./]*[^/])$ $1/
  5.  RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L]
  6. </IfModule>
a ##RewriteBase## directive needs to be added:
  1. <IfModule mod_rewrite.c>
  2.  RewriteEngine on
  3.  RewriteBase /wiki
  4.  RewriteCond %{REQUEST_FILENAME} -d
  5.  RewriteRule ^(.*/[^\./]*[^/])$ $1/
  6.  RewriteRule ^(.*)$ wikka.php?wakka=$1 [QSA,L]
  7. </IfModule>




CategoryWorkaround
There are 6 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki