After 5 years of writing and getting tired of linking urls that look like http://www.myrddin.de/2011/01/19/enhancement-shaman-soloable-bosses/ I thought it would be nice to get rid of the date part and shorten urls for irrelevant information. The whole purpose of the standard “year/month/day” structure is to make it easier for wordpress to recognize an url as belonging to a post.

Change Permalink Structure

Actually this is quite easy to change. You can go to WordPress Admin -> Settings -> Permalinks -> Custom

And change the default /%year%/%monthnum%/%day%/%postname%/ to /%postname%/

Fix 404 Errors

So far, so good … but … what happens to all the links from external sources/bookmarks? They will all lead to a “404, page not found”-error.  To fix this change the .htaccess file and  and find “RewriteEngine on” now simply add:

RewriteRule /([0-9][0-9][0-9][0-9])$/([0-9][0-9])$/([0-9][0-9])$/(.*)/ /$4/ [R]

This will rewrite all urls that look like this (# = number) /####/##/##/postname/ to /postname//, for example http://www.myrddin.de/2011/02/18/enhancement-shaman-vs-archavon-the-stonewatcher/ to http://www.myrddin.de/enhancement-shaman-vs-archavon-the-stonewatcher/

Update: For some reason this stopped working, But with redirect it is working properly again:

RedirectMatch permanent /([0-9][0-9][0-9][0-9])/([0-9][0-9])/([0-9][0-9])/(.*)/ http://www.myrddin.de/$4/
RedirectMatch permanent /([0-9][0-9][0-9][0-9])/([0-9][0-9])/([0-9][0-9])/(.*) http://www.myrddin.de/$4/

This .htaccess hack is working fine on myrddin.de, old and new display the same page.

Hope this helps!

Leave a Reply

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

Ads