Rewrite rules

From Wiki2
Revision as of 22:24, 3 January 2014 by Tim (talk | contribs)

Why .htaccess won't work

if ALLOW OVERRIDE NONE is anywhere in /etc/apache2/sites-available or /etc/apache/apache2.conf

mediawiki rewrite rules

if you want a setup like http://wiki.sitebuilt.net/Tobin ...

1. create subdomain in /etc/sites-available as in these directions

<VirtualHost *:80>
 ServerName wiki.sitebuilt.net
 DocumentRoot /home/wiki/public_html
 # Other directives here
</VirtualHost>

2. got0 http://shorturls.redwerks.org/ and follow the directions which ends up with in /etc/sites-available/wiki add

   RewriteEngine On
   RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
   RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
   RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/wiki/index.php [L]
   RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
   RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
   RewriteRule ^/?wiki/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/wiki/thumb.php?f=$1&width=$2 [L,QSA,B]
   RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
   RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
   RewriteRule ^/?wiki/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/wiki/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

and at the bottom of localsettings.php add

 $wgScriptPath = "/wiki";
 $wgScriptExtension = ".php";
 $wgArticlePath = "/$1";