Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WordPress htaccess permalinks

I migrated from a Windows server to a Linux one and I am very new to htaccess. Also, I changed my permalinks structure from /year/month/post to /post . To make sure the old search engine links still worked I added the following line to the htaccess file which is working fine to redirect the old URLs to the new ones, but read on:

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://www. keptlight .com/$3

Now, my year/month archives always point to the site root since /year/month/ are being stripped. For instance:

www. keptlight .com/2014/02/ orchis-is-coming-2/

is properly redirected to:

www. keptlight .com/orchis-is-coming-2/

But the monthly posts for a given month:

www. keptlight .com/2011/06/ or any other year/month is always redirected to:

www.keptlight.com

Is there a way to overcome this problem and properly display the monthly archives when only year/month/ follows the domain with no post title?

Thank you in advance.

Cemal Ekin


1 Answers

Try

RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})(/.+)+$ http://www.keptlight.com$3
like image 93
Aleksandar Jakovljevic Avatar answered Feb 26 '26 17:02

Aleksandar Jakovljevic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!