1

I am trying to correct a problem on a Wordpress site which is producing duplicate pages in the format of:

/about-us/connecticut/3/3 /about-us/connecticut/3/3 /about-us/connecticut/3/ /about-us/connecticut/3 /about-us/connecticut/

I cannot determine what is causing this to happen.

Can anyone suggest ways to stop this from happening?

Thanks, Josh

6
  • would need more info... or an actual link might be helpful...
    – Jake
    Commented Dec 11, 2012 at 22:51
  • Here is the url:goo.gl/28kEF. Please let me know what other information would be helpful. Commented Dec 12, 2012 at 4:06
  • For the most part, I am seeing expected behavior. All URLs either show 404 or go to the connecticut page. It is interesting, however, that adding a single digit after a post url doesn't affect it. I see the same behavior on my own blog. If you really need to redirect them you could use an .htaccess rule.
    – Jake
    Commented Dec 12, 2012 at 5:33
  • Thanks! What is causing this behavior? How can I stop it? I certainly don't want people to link to these versions or for them to get indexed. Commented Dec 12, 2012 at 9:31
  • With the 404 error pages, you are fine. That is ideal. The users need to see something. It seems unlikely that the pages with digits added to their url will get indexed or found if you aren't linking to them. How did you find them? I haven't seen this as a problem before.
    – Jake
    Commented Dec 17, 2012 at 20:14

1 Answer 1

0

You could try adding this above your wordpress rules in your .htaccess:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^about-us/([^/]+)/([0-9]+)/$ about-us/$1/ [R=301,L]

It isn't very useful, but that could be a good thing. It would redirect any grandchild of the about-us directory that is only numbers to its parent page (child of about-us).

This one is universal. In my limited testing it works great to remove any numbers at the end of a url. It would make is so that you could never name a page using only numbers. any page would need to have letters in it as well.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)/([0-9]+)/?$ $1/ [R=301,L]

That one will most likely have unforeseen consequences, so if you use it, just keep it in mind anytime you have to troubleshoot some strange behavior...

You could also limit any of these to only redirect a single hanging digit instead of any number of hanging digits by changing:

([0-9]+)

to:

([0-9])

Hope that helps...

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.