Need help with a Wordpress .htaccess edit

cmeinck

Well-known member
I'm hoping that someone can help with an issue I'm having with my .htaccess, specific to my Wordpress blog. Here's a short background to how I got here and my issue. My URLs had been appended with /day/month/year/. For some odd reason, Google started indexing them without the date. I figured, follow their lead and remove the dates. To do this, I used the following redirect in .htaccess.

Code:
RewriteEngine On
RedirectMatch 301 ^/([^/]+)/([0-9]{4})/([0-9]{2})/([0-9]{2})/$ http://www.mysite.com/$1

This works great. However, I also have a separate redirect in .htaccess to always include the trailing slash. This works great if someone types in the new URL without the slash. What happens with the above URLs is that it redirects to the non-trailing slash and redirects again to add the trailing slash. The result is 3 hops.

Here's a sample URL:
www.mysite.com/case-review/2013/01/16/

This redirects to:
www.mysite.com/case-review

Which in turn redirects to:

www.mysite.com/case-review/

Normally, I wouldn't mind, since it's working. However, in Google Webmaster Tools, it lists hundreds of duplicates. They aren't indexed, from what I can tell, but they are showing up here as dupes. I'm not sure if the added redirect is causing Googlebot to get confused. I figure that if I can add that trailing slash to the original redirect, it might correct the problem. Either way, it can't hurt.

If anyone has experience with .htaccess, I'd greatly appreciate any help getting this sorted out.
 
Top Bottom