Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
    
would need more info... or an actual link might be helpful... –  Jake Dec 11 '12 at 22:51
    
Here is the url:goo.gl/28kEF. Please let me know what other information would be helpful. –  Josh Fialkoff Dec 12 '12 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 Dec 12 '12 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. –  Josh Fialkoff Dec 12 '12 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 Dec 17 '12 at 20:14

1 Answer 1

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...

share|improve this answer
    
Yes, thank you so much! –  Josh Fialkoff Dec 18 '12 at 9:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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