Zaeo Zaeo - 5 months ago 9x
PHP Question

301 redirects htaccess configuration

I'm working on a website Drupal to Wordpress conversion for a client, and the site has a LOT of content. Over 300 pages, and 750 blog posts.

I'm looking for a .htaccess 301 redirect for the blog posts, but doing 750 different 301 redirections seems horribly inefficient. I'm already biting the bullet for the 300 pages.

Is there a rewrite rule I can utilize to rewrite the following url?

Redirect 301


The dates go from 2016 to 2008.

Before I invest several hours into the per url basis, I want to see if there is a rewrite condition/rule I can utilize.



This should do it:

RewriteRule ^blog/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)?$ /blog/$4 [R=301,L]

This matches "4 digits/2 digits/2 digits/whatever" and rewrites such requests to "/blog/whatever".