About nixCraft

Topics

Lighttpd Mediawiki wiki SEO rules and installation

Posted by Vivek Gite [Last updated: April 9, 2007]

MediaWiki is a web-based wiki software application used by famous wikipedia project. This software is quite famous and scales very well.

Installing mediawiki under Lighttpd is quite simple. If you need clean SEO urls; just follow these instructions.

Download and install wiki software in your domain directory. For example install software under /home/lighttpd/theos.in/http/w directory.

Download mediawiki

Visit official site to download latest version or use wget command:
$ cd /home/lighttpd/theos.in/http
$ wget http://download.wikimedia.org/mediawiki/1.9/mediawiki-1.9.3.tar.gz
$ tar -zxvf mediawiki-1.9.3.tar.gz
$ mv mediawiki-1.9.3 w

Make sure you have correct permissions to store configuration file:
$ cd w
$ chmod a+w config

Install mediawiki

Open a web browser and install mediawiki by visiting url yourdomain.com/w/ i.e. http://theos.in/w/. When done copy config/LocalSettings.php file to /home/lighttpd/theos.in/http/w directory:
$ mv config/LocalSettings.php .

Configure Mediawiki lighttpd SEO rules

Open lighttpd.conf file:
# vi /etc/lighttpd/lighttpd.conf
Locate your virtual domain configuration and add following code:
url.rewrite-once = ( "^/wiki/([^?]*)(?:\?(.*))?$" => "/w/index.php?title=$1&$2" )
url.redirect = ( "^/(?!w|wiki|robots\.txt|favicon\.ico)(.*)" => "/wiki/$1" )

Save and close the file. Restart lighttpd:
# /etc/init.d/lighttpd restart

Configure Mediawiki for clean SEO urls

Open /home/lighttpd/theos.in/http/w/LocalSettings.php file:
$ vi LocalSettings.php
Append following config directive:
$wgArticlePath = "/wiki/$1";

Save close the file. Fire a web-browser and type url yourdomain.com/wiki/ i.e. http://theos.in/wiki/.

References:

Tell us how we're doing: Please answer a few questions about your experience to help us improve nixCraft.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. joshua Says:

    This howto does not work. I get 404 and I’m pretty sure the rewrite itself work. BTW you can put the url.rewrite-once anywhere to your config. I have no idea what’s the problem.

  2. Fr3d Says:

    Good guide, thanks :-) - however the redirect rule seems incorrect - should it not be redirecting to /wiki/$1, not /w/$1, as that’s where the files were moved to? ;-)

  3. vivek Says:

    Fr3d,

    I’ve installed wikimedia in /w/ directory, so so it is correct. Basically instead of serving page from domain.com/w/Main_page I’m using domain.com/wiki/Main_page but my user registration and posting is done via domain.com/w/index.php?option url :)

    Appreciate your post!

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.