Difference between revisions of "Mediawiki rewrite rules"

From Wiki2
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:


1. create [[subdomain]] in /etc/sites-available as in [[subdomain| these directions]]
1. create [[subdomain]] in /etc/sites-available as in [[subdomain| 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
2. got0 http://shorturls.redwerks.org/ and follow the directions which ends up with
Line 11: Line 16:
     RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
     RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
     RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/wiki/index.php [L]
     RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/wiki/index.php [L]
     RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
     RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
     RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
     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]
     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} !-f
     RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
     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]
     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";

Latest revision as of 14:41, 31 December 2013

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";