Lighttpd Mediawiki wiki SEO rules and installation

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/ directory.

Download mediawiki

Visit official site to download latest version or use wget command:
$ cd /home/lighttpd/
$ wget
$ 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 i.e. When done copy config/LocalSettings.php file to /home/lighttpd/ 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/ file:
$ vi LocalSettings.php
Append following config directive:
$wgArticlePath = "/wiki/$1";

Save close the file. Fire a web-browser and type url i.e.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • joshua May 1, 2007 @ 4:52

    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.

  • Fr3d May 18, 2007 @ 20:29

    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? 😉

  • 🐧 nixCraft May 18, 2007 @ 21:23


    I’ve installed wikimedia in /w/ directory, so so it is correct. Basically instead of serving page from I’m using but my user registration and posting is done via url 🙂

    Appreciate your post!

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum