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
Ruchira
View all posts by Ruchira

{ 17 comments… read them below or add one }

1 Hasitha December 8, 2010 at 5:07 AM

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

my WP Permalink Structure is like this,

/%post_id%/%category%/%postname%.html

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

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

Reply

2 Ruchira December 8, 2010 at 5:33 AM

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

Reply

3 Hasitha December 8, 2010 at 5:56 AM

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

Reply

4 Ruchira December 8, 2010 at 5:58 AM

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

And let me know if it works or not!

Reply

5 Hasitha December 8, 2010 at 6:16 AM

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.

🙁

Reply

6 Ruchira December 8, 2010 at 6:18 AM

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

Reply

7 Hasitha December 8, 2010 at 6:29 AM

Okey I ll give it a try !

Reply

8 Hasitha December 9, 2010 at 6:13 AM

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

http://img375.imageshack.us/img375/4792/nano0.jpg

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

Reply

9 Ruchira December 9, 2010 at 6:56 AM

its correct! Can you try this
server.error-handler-404 = "/index.php?error=404"

After adding restart vps and tell me!
Thanks

Reply

10 Daniel July 25, 2011 at 5:17 PM

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

Reply

11 Ruchira July 26, 2011 at 11:36 PM

ooops thanks 🙂 Yes those problems sometimes drives me nuts too! 🙂

Reply

12 kkk August 27, 2011 at 4:13 AM

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?

Reply

13 Ruchira August 27, 2011 at 7:21 AM

are you using wp-pagenavi plugin?

Reply

14 kkk August 27, 2011 at 11:00 AM

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

Reply

15 kkk September 11, 2011 at 9:26 AM

any help regarding my problem?

Reply

16 Raihan January 31, 2012 at 11:57 AM

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.

Reply

17 Ruchira February 15, 2012 at 12:30 AM

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

Reply

Leave a Comment

Previous post:

Next post: