I’m migrating a custom coded blog over to WordPress, and have to set up a redirect that will handle all of the blog posts.
I need to redirect from this:
/oldblogdirectory/Old_Blog_Posts_Looked_Like_This.htm
to:
/newblogdirectory/new-blog-posts-look-like-this/
Any ideas on the regex for a redirect like this?
Gumbo’s approach is certainly the way to do it. I made two test directories:
And the following RewriteRules redirect successfully. They are only slightly changed to Gumbo’s proposal:
Note that the
[N]causes the .htaccess file to be re-evaluated until the RegEx no longer matches. Therefore you should put it at the very top of the file.