PDA

View Full Version : Rewriting URLs



Recursion
18-03-2012, 01:52 PM
'sup,

So can anyone help with rewrite rules here? I have a MediaWiki install in the root of the web directory and am trying to get the URLs to look 'pretty'. So far I have http://wiki.example.com/index.php/Main_Page but I want to get rid of the index.php part, so it just looks like http://wiki.example.com/Main_Page.

.htaccess:


RewriteEngine On
RewriteRule ^[^:]*\. - [L]
RewriteRule ^[^:]*\/ - [L]
RewriteRule ^/*$ /index.php?title=Main_Page [L,QSA]
RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]


LocalSettings.php


$wgScriptPath = "";
$wgScriptExtension = ".php";
$wgUsePathInfo = true;



Thanks

Zuth
18-03-2012, 07:58 PM
Its a good job I was looking for extensions for the HabboxWiki earlier and came across this: (I know its not an extension)

http://www.mediawiki.org/wiki/Manual:Short_URL


Defaults
MediaWiki's default installation path usually looks something like this:
/var/www/localhost/htdocs/mediawiki/w (installed as root user)
/home/johndoe/public_html/mediawiki/w (installed with a shared hosting provider)
MediaWiki's default page addresses looks like these examples:
http://example.com/w/index.php/Page_title (recent versions of MediaWiki, unless using CGI)
http://example.com/w/index.php?title=Page_title (recent versions of MediaWiki, using CGI)
Using the methods below, short webpage addresses can be changed to addresses such as these:
http://example.com/wiki/Page_title (this is the standard, same as in Wikipedia)
http://wiki.example.com/Page_title (not recommended!)

Hope it helps :)

Want to hide these adverts? Register an account for free!