How to change the WordPress permalink structure to remove dates from the URL

If the content you write isn’t date specific (ie. news), it’s a good idea to remove the date from the URL of your WordPress site.  This is also good if, like me, you don’t blog on a super regular basis and don’t want people to know the awesome content you wrote is actually a few months old.

Switching the permalink structure from /year/month/post-slug to just /post-slug is easy by going to Settings > Permalinks and choosing “Post name”:

change permalink structure remove dates wordpress

But you don’t want any links to your old URLs to end up generating a 404, negatively affecting SEO.  To fix this you’ll want to add in a redirect into your .htaccess file similar to:

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$$3

Yoast, the makers of the WordPress SEO plugin, also created a handy redirect generator, in case you were using a different permalink structure before or you have WordPress installed in a subfolder (ie. /blog).