Reputation: 192
I'm migrating a blog to a new platform. I've handled 301 redirects for individual URLS via .htaccess. The old blog has individual URLs for archives for each month of each year. As the blog has been active for around a decade, there's a lot of them. I need each of these URLs to re-direct to a single archives page in the new blog. Due to the number of URLs, I have no interest in entering individual 301s for each one, and I want to write a regular expression to match and redirect these.
So, an example of an old URL: http://www.example.com/2014_11_01_archive.html This would redirect to: http://www.example.com/archives/
What I have in the .htaccess currently:
RedirectRule ^/.*_archive.html$ http://www.example.com/archives [R=301, L]
Which results in a 500 error. Looking for ideas as to what I have wrong about this.
Upvotes: 1
Views: 287
Reputation: 41219
Try with RedirectMatch directive:
RedirectMatch 301 ^/.*archive\.html$ http://www.example.com/archives/
Upvotes: 1