WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

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


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.