Remove year and month in URL using .htaccess

Assuming you have already changed the permalinks structure as @RickHellewell suggests, then you can do something like the following near the top of your .htaccess file (before the existing WP front-controller) to redirect the old URLs (with the stated format) in order to preserve SEO.

RewriteRule ^\d{4}/\d\d/([a-z-]+\.html)$ /$1 [R=301,L]

Leave a Comment