I’ve changed my CMS and need to write a mod_rewrite rule to help redirect some of the old URLs.
What I’d like to do is:
- remove “blog/archives”
- replace underscores with dashes
- replace “.html” with a trailing slash
The old link:
http://example.com/blog/archives/the_post_title.html
The new link
http://example.com/the-post-title/
To address 1 & 3 I thought something along the lines of this might work, but it’s not.
RewriteRule ^/blog/archives/([A-Za-z0-9-]+)/?.html$ $1 [L]
Thanks for your suggestions.
For 1 and 3
(note that R=permanent use a 301 redirect, which will be cached for long time but does move your pagerank to the new URL. Use [L,R] to use normal redirection)