Why didn’t I think of this sooner!?

So I was giving myself a hard time by manually adding .htaccess match conditions whenever there was a 404 (file not found) error reported 1 which was related to the old permalink formats I used in my MovableType days.

I realized just how much of an idiot I was when I could’ve used regular expressions. As such, I was able to replace all of them with just these five lines of code:

RedirectMatch permanent ^/blog/archives/(.*)/([0-9]{4})_([0-9]{2})_([0-9]{2})(.*)\.php$ http://nargalzius.com/blog/archives/$2/$3/$4
RedirectMatch permanent ^/blog/archives/(.*)/index_([0-9]{4})\.php$ http://nargalzius.com/blog/archives/$2
RedirectMatch permanent ^/blog/archives/(.*)/index_([0-9]{4})_([0-9]{2})\.php$ http://nargalzius.com/blog/archives/$2/$3
RedirectMatch permanent ^/blog/archives/(.*)/index_([0-9]{4})_([0-9]{2})_([0-9]{2})\.php$ http://nargalzius.com/blog/archives/$2/$3/$4
RedirectMatch permanent ^/blog/archives/([a-z]{1,})($|/$) http://nargalzius.com/blog/archives/category/$1

Let’s break them down shall we? Read More

Notes

Notes
1 which was related to the old permalink formats I used in my MovableType days.