1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with a Wordpress .htaccess edit

Discussion in 'Off Topic' started by cmeinck, Aug 18, 2014.

  1. cmeinck

    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.

    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:

    This redirects to:

    Which in turn redirects to:


    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.

Share This Page