I am a fan of pretty, easy-to-remember URLs (see your address bar). WordPress, the software this blog runs on, allows for such things, but it requires you to make use of so-called rewrite rules on the web server end.
For Apache users, those rules are supplied with WordPress, and it can even set them up for you automatically in some cases. I, however, use lighttpd, not Apache. WordPress does not come with rewrite rules for lighttpd, so I turned to Google. I don’t remember exactly how it transpired, but I recall most of the example rules I found being broken in one way or another, so I fixed some of them up and came up with ones that work perfectly (as far as I know). I hope they can be useful to others, so here goes.
Note: These have been tested with versions 2.3 and 2.5. I’m not sure how well they work with past or future releases.
First, make sure that the mod_rewrite module is loaded.
Single-user WordPress (probably what you want)
Update: Here is a more general solution -> http://sudhaker.com/2008/04/wordpress-permalinks-lighttpd/
Create a file called /etc/lighttpd/wp-rewrite.conf with the following contents:
url.rewrite-once = (
"^" + wpdir + "(wp-.+).*/?" => "$0",
"^" + wpdir + "(sitemap.xml)" => "$0",
"^" + wpdir + "(xmlrpc.php)" => "$0",
"^" + wpdir + "keyword/([A-Za-z_0-9-])/?$" => wpdir + "index.php?keyword=$1",
"^" + wpdir + "(.+)/?$" => wpdir + "index.php/$1"
)Then, in your /etc/lighttpd/lighttpd.conf, you should have something similar to this:
$HTTP["host"] =~ "blog\.nix\.is" {
var.wpdir = "/"
include "wp-rewrite.conf"
}If you installed WordPress in some place other than the web root (e.g. /blog/), then adjust var.wpdir accordingly.
Multi-user WordPress (mu.wordpress.org)
Source: http://mu.wordpress.org/forums/topic.php?id=3901
Create /etc/lighttpd/wpmu-rewrite.conf with the following contents:
server.error-handler-404 = "/index.php"
url.rewrite-once = (
"^/(.*/)?files/$" => "/index.php",
"^/(.*/)?files/(.*)" => "/wp-content/blogs.php?file=$2",
"^(/wp-admin/.*)" => "$1",
"^/([_0-9a-zA-Z-]+/)?(wp-.*)" => "/$2",
"^/([_0-9a-zA-Z-]+/)?(.*\.php)$" => "/$2",
)Then, in lighttpd.conf:
$HTTP["host"] =~ "domain\.com" {
simple-vhost.default-host = "domain.com"
include "wpmu-rewrite.conf"
}This might be slightly different depending on your vhost setup, but you get the idea.
What about multi user with different domains? Then cookies no longer work.
Comment by Viðar — April 20, 2008 @ 1:28 pm
That has nothing to do with pretty URLs, but here’s the solution to your problem anyway: http://wpmudev.org/project/Multi-Site-Manager
Comment by literal — April 20, 2008 @ 2:12 pm
Thank you
It works on my sites :D
Comment by Phim Online — April 26, 2008 @ 7:25 pm
[...] http://blog.nix.is/lighttpd-rewrite-rules-for-wordpress [...]
Pingback by Lighttpd And Wordpress SEO Friendly Permalinks - SEO Web Tips — May 18, 2008 @ 8:08 pm
I’m getting:
2008-05-19 20:23:08: (server.c.872) WARNING: unknown config-key: url.rewrite-once (ignored)
When I restart lighttpd after adding this script, my /etc/lighttpd/lighttpd.conf has this:
$HTTP["host"] =~ “grisepjok\.dancable\.com” {
var.wpdir = “/”
include “wp-rewrite.conf”
}
What do I miss in this setup?
/ Denbert
Comment by Denbert — May 19, 2008 @ 6:29 pm
I think you forgot to load mod_rewrite. Try adding this above the code you pasted:
Comment by Hinrik Örn Sigurðsson — May 20, 2008 @ 11:32 am
Thanks ALOT.
You are my new personal hero.
Fantastic.
/ Denbert
Comment by Denbert — May 20, 2008 @ 7:34 pm
[...] lighttpd rewrite rules for WordPress (tags: wordpress lighttpd rewrite htaccess) [...]
Pingback by links for 2008-06-12 | the sweetview blog — June 12, 2008 @ 5:32 pm
[...] found this awesome post about lighttpd mod-rewrites for Wordpress, written by Hinrik Örn [...]
Pingback by lighttpd rewrite rules for WordPress | fridaytraffic — September 3, 2008 @ 11:27 am
[...] URL rewriting with lighttpd [...]
Pingback by Blogging | Internet Billionaire » Blog Archive » Things-to-Know-before-Using-Permalinks — September 19, 2008 @ 7:04 pm
Sorry, URL changed
http://sudhaker.com/web-development/wordpress/wordpress-permalinks-lighttpd.html
This works seamlessly without any side effect.
Cheers,
Sudhaker
Comment by Sudhaker Raj — October 16, 2008 @ 1:11 pm
Very useful tip,awesome post.
Comment by caleta de fuste — November 2, 2008 @ 1:12 pm
worked great, thanks!!!
Comment by webhosting-dir — November 8, 2008 @ 1:29 am
Good blog
Comment by satheesh — December 8, 2008 @ 10:22 pm
Hmm. Good post.
Comment by breezee1205 — December 9, 2008 @ 11:38 am
Thanks for this – great idea.
Comment by Moliv — December 11, 2008 @ 9:51 pm
Thanks for the post, I have been having the same problems.
Comment by yongyuth — December 12, 2008 @ 1:57 am
[...] URL rewriting with lighttpd [...]
Pingback by Permalinks to your individual weblog posts | how to fix blogs — January 11, 2009 @ 12:16 am
Hi, I am administrating one student webpage and would like to change the default tags for posts to the nice permalinks. Wordpress mentioned that I have to update the .htaccess… Can you please help me what I have to do next, do I have to install something, do I have to rewrite all articles? Unfortunately my access to the webserver is limited. CU harald
Comment by harald — January 23, 2009 @ 12:09 pm
Good stuff i’ve been searched this plugin and This works seamlessly without any side effect.
Comment by Ardhi SEO — January 24, 2009 @ 11:24 pm
thanks for the post i just created my website in wordpress and this helps a lot
Comment by quality seo service — February 6, 2009 @ 7:50 am
[...] Ubuntu Tutorials | literal thoughts « Thanks to UptimeHost for 30-days Trial [...]
Pingback by Solution to WordPress Permalink for lighttpd | WING LOON — March 3, 2009 @ 10:35 am
this is works actually. i have a subdomain points to a folder inside the wp folder. after i add this rewrite rule. this page stopped working. strange..
Comment by jason — March 19, 2009 @ 7:06 pm
[...] tienen un blog con dominios más razonables, pueden ver una solución que aparentemente funciona aquí. Para aquellos a los que no les interesan estas cuestiones técnicas, hay un nuevo Ramblings. [...]
Pingback by 7c0h » URLs con Wordpress y Lighttpd — April 7, 2009 @ 11:14 pm
[...] WordPress & WordPress Mu的规则 [...]
Pingback by WordPress资料站 » Blog Archive » WordPress MU 安装及相关设置 — April 15, 2009 @ 12:21 am
[...] lighttpd rewrite rules for WordPress [...]
Pingback by Lighttpd + PHP + MySQL + eAccelerator = Wordpress on steroids | Les Aventures de Techiemaque... — April 30, 2009 @ 9:12 am
A useful note on SEO and Social Media – both are necessary for all business owners these days. I was recently at a talk by Brad Sugars, Australian entrepreneur with an international business coaching business owners, and he was emphasising with real life stories the benefits of Facebook, LinkedIn and Twitter to business owners.
Comment by Music Information — May 30, 2009 @ 7:11 pm
[...] lighttpd rewrite rules for WordPress literal thoughts Posted by root 1 hour 47 minutes ago (http://blog.nix.is) I am a fan of pretty easy to remember urls see your address bar comment by tenzamak may 20 2009 2 42 pm wordpress is the best cms out there Discuss | Bury | News | lighttpd rewrite rules for WordPress literal thoughts [...]
Pingback by lighttpd rewrite rules for WordPress literal thoughts | Outdoor Ceiling Fans — May 31, 2009 @ 8:20 am
[...] lighttpd rewrite rules for WordPress literal thoughts Posted by root 2 hours 21 minutes ago (http://blog.nix.is) I am a fan of pretty easy to remember urls see your address bar comment by tenzamak may 20 2009 2 42 pm wordpress is the best cms out there Discuss | Bury | News | lighttpd rewrite rules for WordPress literal thoughts [...]
Pingback by lighttpd rewrite rules for WordPress literal thoughts | Outdoor Ceiling Fans — May 31, 2009 @ 12:49 pm
[...] lighttpd rewrite rules for WordPress literal thoughts Posted by root 5 minutes ago (http://blog.nix.is) Comment by quality seo service february 6 2009 7 50 am rewrite rules for wordpress literal thoughts outdoor ceiling fans may 31 2009 8 20 am Discuss | Bury | News | lighttpd rewrite rules for WordPress literal thoughts [...]
Pingback by lighttpd rewrite rules for WordPress literal thoughts | Hammock Stand — June 1, 2009 @ 5:26 am
[...] lighttpd rewrite rules for WordPress literal thoughts Posted by root 35 minutes ago (http://blog.nix.is) Thanks for the post i just created my website in wordpress and this helps a lot comment by quality seo service february 6 2009 7 50 am Discuss | Bury | News | lighttpd rewrite rules for WordPress literal thoughts [...]
Pingback by lighttpd rewrite rules for WordPress literal thoughts | Uniform Stores — June 1, 2009 @ 2:00 pm
you’ve done a great job. this is really works .
Comment by wisata seo sadau — June 2, 2009 @ 9:40 am
I have found what i was looking for !!! thx )
Comment by BestHelen — June 6, 2009 @ 1:31 am
you are right!
Comment by tiffany and co — June 10, 2009 @ 5:02 am
Interesting post. I have made a twitter post about this. Hope others find it as interesting as I did.
Comment by Craigslist Phone Verified Accounts — June 13, 2009 @ 1:00 pm
[...] lighttpd rewrite rules for WordPress literal thoughts Posted by root 15 minutes ago (http://blog.nix.is) Comment by hinrik rn sigur sson may 20 2008 11 32 am rewrite rules for wordpress literal thoughts outdoor ceiling fans may 31 2009 8 20 am Discuss | Bury | News | lighttpd rewrite rules for WordPress literal thoughts [...]
Pingback by lighttpd rewrite rules for WordPress literal thoughts | Outdoor Decor — June 13, 2009 @ 9:38 pm
Something which the tutorial doesn’t mention, and probably should because it got me very confused when things didn’t work, is that you need to restart lighttpd for this to take effect. Maybe obvious to seasoned syadmins but I’m a n00b and it would have been helpful :P
sudo /etc/init.d/lighttpd restart
Should do the trick. Thanks for the post though, very helpful.
Comment by Alex — June 14, 2009 @ 6:23 pm
verry nice thnx
Comment by Hosting — June 16, 2009 @ 2:46 pm
i have found what i was looking for !!! thx )
Comment by hkservercolocation — June 17, 2009 @ 3:09 am
[...] lighttpd rewrite rules for WordPress literal thoughts Posted by root 4 minutes ago (http://blog.nix.is) Comment by hinrik rn sigur sson may 20 2008 11 32 am rewrite rules for wordpress literal thoughts outdoor decor june 13 2009 9 38 pm Discuss | Bury | News | lighttpd rewrite rules for WordPress literal thoughts [...]
Pingback by lighttpd rewrite rules for WordPress literal thoughts | patio set — June 18, 2009 @ 2:02 am
Your blog is great! Just bookmarked it :)
Comment by James Kingston — June 20, 2009 @ 9:13 am
this is works actually. i have a subdomain points to a folder inside the wp folder. after i add this rewrite rule. this page stopped working. strange..
Comment by oyUn — June 22, 2009 @ 6:13 pm
A complicated one but thanks for posting this.
Comment by Sophie Elise — June 24, 2009 @ 7:52 am
[...] Mu在 lighttpd下的Rewrite规则(来源): $HTTP["host"] =~ "kuihuadi.com" { simple-vhost.default-host = [...]
Pingback by kuihuadi已出国,以及Wordpress Mu在lighttpd下的Rewrite规则 – MakLu在地球 — June 29, 2009 @ 5:48 pm
Hi, thnkyou so much for this it works with all my wordpress installs
What I would like to ask is how do I turn it off in certain static directories within my main wordpress directory, I used to achieve this on apache with .htaccess by essentially turning the rewrite engine off inside the directory I needed to work as a normal directory
I hope I made that sound clear enough and not confusing ;-)
Thankyou for your help m8
Comment by Marty — July 7, 2009 @ 1:07 pm
hi again for a simple workaround I used this
“^/.*\.(jpg|jpeg|gif|png|swf|avi|mpg|mpeg|mp3|flv|ico|css|html|htm)$” => “$0″,
and now anything I may have uploaded into a folder that is inside my wordpress install but independant of wordpress is accessible
I know this isnt the best solution but it will suffice for me for now
Once again thankyou for this useful tip I will be subscribing to this blog now!
Comment by Marty — July 7, 2009 @ 5:17 pm
This works seamlessly without any side effect.
Comment by medyum — July 18, 2009 @ 11:56 am
[...] Rules for WordPress & WordPress Mu [...]
Pingback by Installing WPMU, Wordpress Multi User - The Center of the Information And Communication Technology — July 21, 2009 @ 11:02 am
Thanks for your information!
Comment by links of london — July 27, 2009 @ 8:35 am
Hi,
Thanks for the information,just found this post my technorati news feed section! I was searching for this since past 3 months and i am glad to see it here. Thanking you much
Martin
Comment by Water ionizer — August 13, 2009 @ 3:50 am
thanks for the info, just what I needed
Comment by Jhonatan "directorio cusco" Juanca — September 1, 2009 @ 12:07 am
thanks for the post, is very useful
Comment by David "autogobierno ayllu" Holger — September 1, 2009 @ 12:09 am
[...] Infos dazu gibts auch bei: Hinrik und [...]
Pingback by Wordpress Permalinks mit lighttpd realisieren at webCONSUL — September 12, 2009 @ 6:57 pm
I like your post & i will always be coming frequently to read
more of your post.Thank you very much for your post once more.
Comment by How to stay longer in bed — September 15, 2009 @ 8:02 pm
[...] Rules for WordPress & WordPress Mu [...]
Pingback by Documentação Técnica » Wordpress MU – Instalação — September 18, 2009 @ 2:01 pm
Thanks for these instructions! :)
It was following these instructions that got my rewrite rules working for wordpress-mu + lighttpd
I had a problem with buddypress though. I managed to fix it by following the link to your source for wpmu instructions and managed to fix my code with a couple of lines.
If you need to get buddypress working properly with lighttpd then see:
http://trac.buddypress.org/ticket/1078#comment:10
Comment by Josef Davies-Coates — September 27, 2009 @ 3:58 pm
Wow,
What a nice post,i just found this post story from my technorati profile news feeds section! I was searching for this since past 3 months and i am glad to see it here. Thanking you much
Kathe
Comment by Catherine Michael — October 11, 2009 @ 3:25 am
Great helpful information, Thanks for this nice post, just subscribed your feed, hope you will update new post soon.
keep it up.
Aaron.
Comment by Aaron Wall — October 11, 2009 @ 8:01 am
Thank you. Fot lighttpd users it’s really usefull. We have a lot o Apache Rewrite/.htaccess tutorials but it’s different for lighttpd.
Comment by File Search — October 12, 2009 @ 3:11 pm
Discrimination that is wrong in one context may be acceptable in another. ,
Comment by SouthWind35 — October 23, 2009 @ 1:44 pm
Pretty interesting topic there, I think you covered it quite well, was a very interesting blog post to read.
Comment by Watch 90210 Season 2 Online — October 24, 2009 @ 1:23 am
[...] 404处理技术 、 mod_rewrite 或者 mod_magnet (可以参看 External [...]
Pingback by WordPress中自定义你的文章链接 - Domety — October 25, 2009 @ 1:24 pm
Hi, thank you so much for this post. Continue posting like this one.
Comment by US College Search — October 29, 2009 @ 10:41 am
Thanks for the excellent work, you saved me….
Comment by Gaurav — November 1, 2009 @ 4:50 pm
Ya thats i looking for. Very good it will me help for my wp blog.
best thanks.
Comment by Paul Pütz Thapa — November 2, 2009 @ 5:48 pm
Thanks ALOT.
You are my new personal hero.
Fantastic.
Comment by Mark — November 3, 2009 @ 7:36 am
Its very useful info thanx very much
Comment by fast software — November 5, 2009 @ 9:45 pm
[...] Wer wordpress mit lighttpd als webserver laufen lassen will, kann nicht auf die von wordpress generierten .htaccess-Dateien zurückgreifen, da lighttpd diese ignoriert. Hier ist eine gute und einfache Lösung für dieses Problem.[1] [...]
Pingback by wordpress und lighttpd – Das Nerdlabor — November 9, 2009 @ 11:29 am
Your site doesn’t correctly work in Safari 4 in Mac OS X (4Version) :( Please help me How can I remove the problem
Comment by Single — November 20, 2009 @ 1:19 pm
Thanks for this – great idea.
Comment by Berufsbekleidung — December 6, 2009 @ 7:26 pm
[...] http://mu.wordpress.org/forums/topic.php?id=3901 http://blog.nix.is/lighttpd-rewrite-rules-for-wordpress Tagged as: configuration, lighttpd, wordpress Leave a comment Comments (0) Trackbacks (0) ( [...]
Pingback by Wordpress Multiuser and Lighttpd – rewrite rules « Apokryph Weblogs — December 13, 2009 @ 3:23 am
[...] using a 404 handler or mod_rewrite or mod_magnet (see External [...]
Pingback by sawathee » Blog Archive » Using Permalinks — December 14, 2009 @ 8:01 am
It was following these instructions that got my rewrite rules working for wordpress-mu + lighttpd
I had a problem with buddypress though. I managed to fix it by following the link to your source for wpmu instructions and managed to fix my code with a couple of lines.
If you need to get buddypress working properly with lighttpd then see:
Comment by araç sorgulama — December 29, 2009 @ 11:47 am
[...] using a 404 handler or mod_rewrite or mod_magnet (see External [...]
Pingback by Để không có ký tự tiếng việt ở url wordpress (Nicer permalinks for Vietnamese) | Script Online Collection - Free nulled script - Clone sites — January 22, 2010 @ 7:00 pm
Very good it will me help for my wp blog
Comment by reiner — January 26, 2010 @ 3:14 pm
One of the best tutorial i found about wordpress..Thanks for sharing it..
Can you make this a little more complicated. This is not for begginers I take it
Keep it up !!
Comment by Battery Duracell — February 15, 2010 @ 7:18 am
[...] mod_rewrite 或 mod_magnet [...]
Pingback by 使用wordpress的固定连接 | Just For Lee — March 1, 2010 @ 1:52 pm
Man, I do love this awesome story. I’m glad I’ve found you site on Google and I hope I’ll find more great stuff here.
Comment by Karina Blagman — March 5, 2010 @ 8:50 am
Thank you very much …………
…………………………..
Comment by ทํานายฝัน — March 6, 2010 @ 1:32 pm
[...] mod_rewrite 或 mod_magnet [...]
Pingback by 《创想曲》电子杂志 » Blog Archive » 使用WordPress固定链接 — March 7, 2010 @ 9:48 am