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 using the following permalinks structure: /%postname%/ and I also have some multi-page posts that look like /%postname%/2.

The problem is I see a lot of 404 errors in webmaster tools for urls like /post-name/random stuff here

How can I redirect all wrong URLs to the correct ones ?

share|improve this question

migrated from stackoverflow.com Jun 25 '11 at 10:11

This question came from our site for professional and enthusiast programmers.

2 Answers 2

up vote 1 down vote accepted

Have you tried the Smart 404 plugin? http://wordpress.org/extend/plugins/smart-404/

share|improve this answer

I don't have a webserver to test this with, but the following should work:

In your wordpress theme, you can create a 404.php file, which will be used when a 404 response is triggered. Inside this file, you could check the HTTP_REFERRER header entry - if it follows the format /post-name/[nonsensical stuff], you could then redirect the browser to /post-name/. Or simply provide a link with a message saying "couldn't find exactly what you requested, but we think this might be it".

share|improve this answer

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.