MediaWiki Clean URLs for PHP (compiled as CGI)
Media
Wiki has issues when attempting to use "clean URLs" (e.g. http://www.mywiki.com/wiki/Main_Page) on a system with PHP compiled as a CGI. This is a workaround to successfully enable clean URLs while maintaining full compatibility with the server configurations
1) Create a blank .htaccess file located in your wiki's directory or in public_html if your wiki is installed on the root directory. For example, if you have your wiki installed at www.mywiki.com/wiki, you'd want to create the .htaccess file in /home/mywiki/public_html/wiki/ server directory. Alternatively, if you have it at www.mywiki.com, create in /home/mywiki/public_html/
2)
edit and save the .htaccess file with following contents:
NOTE: If you have the Wiki installed on the root directory, remove references to /Wiki/ in the following code.
Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/wiki/(stylesheets|images|skins|Skins|Images|Stylesheets)/
RewriteCond %{REQUEST_URI} !^/wiki/(stylesheets|images|skins|Skins|Images|Stylesheets)
RewriteCond %{REQUEST_URI} !^/wiki/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !^/wiki/(40(1|3|4)|500).shtml
RewriteCond %{REQUEST_URI} !^/wiki/favicon.ico
RewriteCond %{REQUEST_URI} !^/wiki/robots.txt
RewriteRule ^wiki/(.*) wiki/index.php?title=$1 [L,QSA]
RewriteRule ^wiki/Skins/(.*) wiki/skins/$1 [L,QSA]
RewriteRule ^wiki/Images/(.*) wiki/images/$1 [L,QSA]
3)
edit your
Wiki's LocalSettings.php file as follows:
Code:
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
$wgScriptPath = "/wiki";
$wgScript = "$wgScriptPath/index.php";
$wgRedirectScript = "$wgScriptPath/redirect.php";
$wgArticlePath = "/wiki/$1";
That's it! Hope this helps anyone that has been having problems.
Notes/Known Issues
Above code only compatible for PHP compiled as a CGI. Apache-based PHP installs do not require anything special, use the default instructions that come with media
Wiki instead