Lighttpd url-redirect for WordPress Permlink changes

I changed my wordpress blog entry permlink format. But some link to my blog exists on Internet doesn’t work which results in a HTTP 404 error.

Why redirect is better then rewrite

Someone may have the same question, but take it easy, it depends on your decision.

But rewrite has it’s benefits also, existed link will work without any changes. RSS feed, your live writer(maybe you prefer Word2007? :P) will still work, no need to change the configuration.

I want all visitors include search engine spiders get to know that the permlink changes, that’s why I choose redirect, not rewrite.

Draft conf, simple and ugly

For example, http://feuvan.net/wordpress/?p=107 now should be http://blog.feuvan.net/index.php/2007/03/10/win-ce-platform-builder-60-evalutation-offline-download.html, then I have to configure my lighttpd configure like these.

$HTTP["url"] =~ “^/wordpress” {
    url.redirect =(
        “^/wordpress/(.*)$” => “http://blog.feuvan.net/index.php/$1″
    )
}

But some links like http://feuvan.net/wordpress/index.php?p=56 will be redirected to http://blog.feuvan.net/index.php/index.php?p=56, it’s ugly, er……

More clean conf file

So here we have a newer configure file:

$HTTP["url"] =~ “^/wordpress” {
    url.redirect =(
        “^/wordpress/index.php?(.*)$” => “http://blog.feuvan.net/index.php/$1″,
        “^/wordpress/(.*)$” => “http://blog.feuvan.net/index.php/$1″
    )
}

Now the old link will be redirected to http://blog.feuvan.net/index.php/?p=56.

Furthermore

Wait, why not redirect to the new permlink directly?

Maybe I can throw out a solution.

NOTE:

You should enable mod_redirect to make the configuration works for you.

The article is specified to lighttpd 1.4.x series.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
This entry was posted in Default and tagged , . Bookmark the permalink.

One Response to Lighttpd url-redirect for WordPress Permlink changes

  1. DNVC says:

    We are certain that most if not all redirection services are upstanding members of the internet community. Imagine however, if the service was sold, or was hacked. The associations could easily be changed to new destinations. Why would such a service make such an alteration? The financial reward could be immense.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">