Dropping /YYYY/MM/DD from WordPress URL and successfully redirecting

I wanted to drop the Year / Month / Date part of the URL from the Cafe Scientifique site, so what would previously have been
http://cafescientifique.onthewight.com/2014/06/11/barry-arnold-story-chocolate-science-serendipity/
becomes

Barry Arnold: The story of Chocolate: Science and Serendipity

We just didn’t need to know in the URL what the date of the posting was.

Not wanting to lose any URLs that might have been referenced elsewhere, a Redirect Rule was needed.

RegExp code for Redirect Rule
John P. Gamboa and James Gardner at WPE were heroes forming the RegExp needed to do they job. We ended up with

Source: ^/(\d*)/(\d*)/(\d*)/(.*)/?$
Destination: /$4
Domain Wildcards: cafescientifique.onthewight.com

As James pointed out, it was the fourth string that we needed to be used.

Permalink Setting has to be changes from ‘Day and Name’ to ‘Post name’ as well (of course!).

It working
So now
http://cafescientifique.onthewight.com/2014/06/11/barry-arnold-story-chocolate-science-serendipity/
resolves to
http://cafescientifique.onthewight.com/barry-arnold-story-chocolate-science-serendipity/
and none of the other subdomains are affected. Perfect.

Leave a Reply