This is pretty easy and is more of a personal note. First check that mod_redirect is enabled in lighttpd.conf:

[code lang=“bash”]sudo nano /etc/lighttpd/lighttpd.conf[/code]

Uncomment the line that write “mod_redirect”.

[code lang=“bash”]server.modules = (

“mod_rewrite”,

“mod_access”,

“mod_alias”,

“mod_accesslog”,

“mod_compress”,

“mod_redirect”,

…[/code]

Then add the following at the bottom of your lighttpd.conf:

[code lang=“bash”]$HTTP[“host”] =~ “^www.(._)” {

url.redirect = ( “^/(._)” => “http://%1/$1″ )

}[/code]

Finally, give lighttpd a restart and test it out:

[code lang=“bash”]sudo /etc/init.d/lighttpd restart[/code]

Hope it helps.

After I made the switch to Lighty, I totally forgot to do redirect all my www sites to no-www, this results in all people who visit www.darylli.com to be shown the default site which is what you see here basically.

comments powered by Disqus