Help with WordPress Permalink 301 Redirect via .htaccess
-
I am currently attempting to change the permastructure of all of my WordPress posts from:
/%year%/%monthnum%/%postname%/
to just
/%postname%/
.I have already made the change in WordPress and added the following code to my htaccess file to initiate the 301 redirects:
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.+)$ https://www.mydomain.com/$3
Now everything is working perfectly except for 1 thing. It has caused all archived date pages, for example https://www.mydomain.com/2013/8/20, to redirect to https://www.mydomain.com/20, which causes 404s.
My question is how do I edit the code to not reflect those archived dates. I imagine it’s something fairly simple but i know minimal coding and have already spent hours searching online only to come up short. I’m very surprised as the code I used was given as a common fix. I assume most people didn’t either use their calendar widgets, or never noticed this problem who used this method.
Anyway please and thanks for help.
- The topic ‘Help with WordPress Permalink 301 Redirect via .htaccess’ is closed to new replies.