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.

Google Webmaster Tools shows a bad URL of /?p=xxxx

This page id does not exist. I don't use this form of permalink at all.

If I try using a 301 redirect or RewriteRule in .htaccess nothing happens. All my other redirects work fine, but none of them include the format /?p=xxxx

Is there a method to redirect this specific URL type in .htaccess?

Is there a Wordpress admin specific method to redirect this URL? Thanks.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You might not use that form of permalink, but it still exists. By default, unless you are using a tool like JetPack, WordPress uses the default permalink as the post's "shortlink."

So if your regular post title is http://mysite.com/2011/11/my-really-cool-long-post-title and the post's ID is 32, the same post is still accessible as http://mysite.com/?p=32.

If you're using JetPack, this will be replaced by a dynamically-generated http://wp.me address. If you have your own URL shortener (like YOURLs) or plugin, you can create an automatic shortlink using that as well. All of mine, for example, use http://eam.me.

So Google Webmaster tools showing a bad url for your site means:

  • At one point in time, that post ID did exist
  • Someone, not necessarily you, linked to your site using your default shortlink (Some themes will embed your post shortlink in your page markup ... look for <link rel='shortlink' href='http://...' /> in the source of your latest post to check)

There are a couple of things you can do:

  • Ignore it Yes, Google's crawler tried to visit the page and threw an error up on webmaster tools. But this isn't the end of the world. Unless Google shows that people are trying to visit that link every day, you're not losing any traffic. Remember, Webmaster Tools is supposed to help you trouble-shoot and optimize your site, it's not the end-all-be-all of the Internet. Showing one error there won't kill your site.
  • Use a 404 page Have you actually tried to visit this link? What happens? Is a well-designed theme, you'll end up at a 404 page. For example, http://mindsharestrategy.com/?p=9999999 takes you to a 404 page that lists post archives and presents several search options to find the content you're looking for.

Ultimately, you need to remember to design for users, not for bots. If Google is showing a 404 error (you didn't describe what you mean by "bad URL"), then that's exactly what it should be doing. If the page doesn't exist, you need to tell people that it doesn't exist. Don't try to hide errors.

The only place you should ever redirect not-found errors on your site is to a not-found error page.

share|improve this answer
add comment

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.