On a blog, very little blog, ZeroBlog I was using the permalink with the post name as url (/%postname%). Usually I don’t care too much about performances of permalinks but this time I decided to change the permalink structure not for performance but for other personal reasons.

There are many ways to do that, for example some famous permalink change plugins, but on that blog with less than 100 posts the .htaccess and a query were enough. This is the query that generates the rules for the .htaccess:

SELECT concat('RewriteRule ^',post_name,'$'), concat('http://www.zeroblog.it/' , id), '[R=301,L]' FROM `wp_posts` WHERE `post_type`='post' and post_status='publish'

That’s all.

Similar Posts

Leave a Reply