Create Very Short MediaWiki Urls with .htaccess
From IpbWiki
Contents |
Configuration on IpbWiki.Com
This is the way the short url are configured on ipbwiki.com, this may or may not work on your configuration.
Our configuration is as follows:
- PHP 5 runs as an apache 2 module.
- wiki is installed in /wiki
- At the moment of writing this article we use MediaWiki 1.11 (to check the current version look at the Special:Version page)
Be sure to change yourdomain.com by your domain!
Step 1: Create a file .htaccess in the root of your domain
CODE
RewriteEngine on
RewriteCond %{SERVER_NAME} (www.yourdomain.com|yourdomain.com)
#RewriteCond %{REQUEST_FILENAME} !index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)?$ /wiki/index.php?title=$1 [L,QSA]
RewriteCond %{SERVER_NAME} (www.yourdomain.com|yourdomain.com)
#RewriteCond %{REQUEST_FILENAME} !index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)?$ /wiki/index.php?title=$1 [L,QSA]
Step 2: Create a file index.php in the root of your domain
CODE
<?php
header( "Location: http://www.yourdomain.com/Main_Page" );
?>
header( "Location: http://www.yourdomain.com/Main_Page" );
?>
Step 3: Alter LocalSettings.php
Add the following lines to the end of LocalSettings.php:
CODE
$wgArticlePath = '/$1';
$wgUsePathInfo = false;
$wgUsePathInfo = false;
Configured short urls otherwise on your installation? Feel free to add these configurations to this article!
