Using Lighttpd to Redirect to New URL

My blog’s old domain are set to expire in November. The reason I initially registered the domain was to create a family website. My family traditionally has communicated by mass email and reply-all conversations and I thought it would help to give them something different. They rarely used it however so I decided to simply focus on my own blog. Since I have several articles that get regular hits from search engines, I worried that my articles wouldn’t be very visible. I decided to try writing up some redirect rules for my old domain in the lighttpd config file so that anyone going to my old blog links would be redirected to their new addresses.

I came up with the following rules:

$HTTP["host"] !~ "^(bradford).($" {
    $HTTP["host"] =~ "^(.+.)?($" {
    url.redirect = ("(.*)" => "")
    url.redirect-code = 301

$HTTP["host"] =~ "" {
    url.redirect = (
    "^/(.*)$" => "$1" )
    url.redirect-code = 301

The first group handles any request to a subdomain of the old website EXCEPT and redirects them to with a redirect code of 301.

The second group handles any request to and redirects them to WITH the trailing address. This works wonderfully as long as you don’t change the structure of your permalinks.

Remember to enable mod_redirect under server.modules in your lightty configuration file.




hey, buddy, is everything ok? I'm from Brazil. I study Computer Science and I'm learning wordpress. I'd like to talk to you about plugins. Do U know any plugin that you can use to rotate banner in you web site? I mean, rotate acording to the time, and no rotate when U acess other page in you site... Got it?

Thanks, bro!

Leave a comment

Your email address will not be published. Required fields are marked *