WordPress permalinks with lighttpd without mod_magnet

by Ruchira on September 3, 2010

As you can see this blog is powered on lighttpd web server platform. Lighttpd is very fast when compared with apache for static content delivery. But wordpress is not all static but there is slight performance improvement over apache and very lower memory usage can survive digg effect.

But with lighttpd biggest problem is you cant use smartass permalinks on wordpress like me. Ex- www.ruchirablog.com/post-title instead of www.ruchirablog.com/p=44

If you are smart in linux and compilations of server ware this might be simple problem to you. But for average users like us this is a really messy questions.

Lets get to the topic,

Setting up lighttpd is very easy like apache with kloxo search this blog for “installing kloxo” for kloxo installation guide. Kloxo will install both lighttpd and apache in default and you can switch between them on single click.

IF you are using kloxo as your server management tool keep noticed that your kloxo installation doesnt include lighttpd mod_magnet to use permalinks with easy. Integrating mod_magnet will be difficult because kloxo platform is bit complex and its having some issues when installing like normal.

So forget permalinks with mod_magnet even you are with kloxo or other setup of lighttpd.There is much easier way of using all kinds of permalinks in just single line of mod in lighttpd.conf file.

Just fire up your SSH client (PUTTY)

Enter to your server by using root privileges.

Then you need to find and edit lighttpd.conf file on your server. If you dont know where is lighttpd.conf file type

Whereis lighttpd.conf

It will display the path to lighttpd.conf file
wordpress permalinks

Then fireup your favorite text editor ( my favorite is NANO to install nano type “Yum install nano” on SSH )

then open lighttpd.conf with NANO. Command for this on kloxo setup is “nano /etc/lighttpd/lighttpd.conf”

Then add this simple line to your lighttpd.conf file.

server.error-handler-404 = "/index.php"


This one line support for all structures of permalinks. No matter what it is.
This is it one simple line does it all instead of crazy mod_magnets :)


But please note that plugin WP-Super-Cache will not work with this mod. it needs mod_magnet but you can use WP-Cache or Hyper-cache plugins as you caching plugin. I personally use Hyper-Cache but ill test WP-Cache later too.

I'm Ruchira Sahan and all posts on this blog are completely my thoughts and writings. I love DIY and Technology. So feel free to contact me for anything about this blog and don't forget to add a comment if this blog helped you! Thanks
View all posts by Ruchira

Last 5 posts by Ruchira

  • http://www.hasitha.com Hasitha

    Hmm for some reason it didn’t work for me. I’m getting a 404 error.

    my WP Permalink Structure is like this,


    and I added this like to lighttpd.conf file using Nano,

    server.error-handler-404 = “/index.php”

    • http://www.ruchirablog.com Ruchira

      Did you reloaded the lighttpd after adding the server error handler?

  • http://www.hasitha.com Hasitha

    Well I did restart the VPS. That should do it, right ?

    • http://www.ruchirablog.com Ruchira

      Your permalink structure looks wrong to me! Can you try this structure in custom structure mode?

      And let me know if it works or not!

      • http://www.hasitha.com Hasitha

        Didn’t work. same error. it shows right url but a 404 error.

        I have used that custom structure for over 2 years now in various blogs. Haven’t had a problem.


        • http://www.ruchirablog.com Ruchira

          everything looks normal than .html at last! try this if you like http://www.ruchirablog.com/nginx-autoinstaller/ very is too use permalinks with+ nginx performance! this blog runs on it too! :)

          • http://www.hasitha.com Hasitha

            Okey I ll give it a try !

  • http://www.hasitha.com Hasitha

    Here’s the line have added conf file using nano. Is this correct ?


    (nginx means I have to rebuild the vps which I can’t do for a while ^^)

    • http://www.ruchirablog.com Ruchira

      its correct! Can you try this

       server.error-handler-404 = "/index.php?error=404"

      After adding restart vps and tell me!

  • Daniel

    You’re the smartest on earth
    You saved my time and work and nerves
    Thank you.

    • http://www.ruchirablog.com Ruchira

      ooops thanks :) Yes those problems sometimes drives me nuts too! :)

  • kkk

    thanks it works but now im facing another problem with ‘search’..when i search for something which has more than 1 page the second page goes to second page of the site and not the second page of results..if i put the default permalinks it works fine but when i add the custom permalink it doesnt work

    any ideas?

    • http://www.ruchirablog.com Ruchira

      are you using wp-pagenavi plugin?

  • kkk

    yes but in another theme im using wp-numbers still the same prob but im not sure for this…but on current theme its pagenavi

  • kkk

    any help regarding my problem?

  • Raihan

    do you know any way to access directory?after this edit i unable to access other folder which i previously access by mydomain.com/directory .and download file from that folder.

    • http://www.ruchirablog.com Ruchira

      f you followed the guide correctly you shouldnt have a problem. but maybe you have additional rules set on lighttpd conf preventing directory access!

Previous post:

Next post: