John Siu Blog

Tech - Business Tool, Personal Toys

Lighttpd Redirect and WordPress Permalink

☰ Table of Content

I used to use the Date and Name permalink structure for my blog.


But I think it is kind of long and want to shorten it, and change it to Post name structure:


Changing that is as easy as a few clicks in WordPress setting. All existing and future posts will have the new Post name structure.


However, after I uploaded the new sitemap to Google Webmaster Tool, and start checking my site information, especially Links to Your Site under Search Traffic, I noticed a big issue.

After the permalink structure change, all the links out there with the old structure become broken! Not good!


Solution? Lighttpd Url.redirect

Since Date and Name permalink format is well structured, the redirect rules is easy:

url.redirect = ("^/index.php/\d{4}/\d{2}/\d{2}/(.*)$" => "/index.php/$1")

John Siu

Update: 2020-08-16
comments powered by Disqus