5

WordPress apparently will resolve partial URLs to the "correct" page when entered at the parent level. Google is including this partial URL in its search results. For example, years ago I wrote a blog post about a site called Bookeo:

http://www.example.com/2011/04/bookeo/

If you type in this it will resolve to the above URL.

http://www.example.com/book/

For some reason Google actually cached the /book/ URL, as if it's its own page. If you search my sitename + book it returns the shortened, incorrect URL. This is the last thing I want since people might go there expecting to book an appointment or something.

As an aside WP actually resolves to the first result that matches. So if you had blog posts with /book1/ and /book2/ it'd pick the first one.

Is there a way to make Google only cache the correct destination URL? The sitemap only includes the right one and is linked in robots.txt. I just manually submitted it to Google webmaster as well.

Is my only option to update robots.txt to block /book. Or figure out how to disable that URL resolution functionality in WordPress?

4
  • 2
    "Or figure out how to disable that URL resolution functionality in WordPress?" <-- That is the correct thing to do. // I would also strongly recommend AGAINST blocking with robots.txt, if you want to block you should configure the server to send an "X-Robots-Tag: noindex" header for the particular URL.
    – Oskar Skog
    Commented Jul 27, 2017 at 19:55
  • 1
    Google is doing nothing wrong... the way you setup WordPress is more likely. At some point /book/ did not 301 redirect. Google will drop /book/ in due course. Allow 2-3 weeks. Commented Jul 27, 2017 at 20:02
  • FWIW I see only the longer (correct) URL in the Google SERPs? What's the exact search term you are using?
    – MrWhite
    Commented Jul 27, 2017 at 21:01
  • it since removed my URL and updated it to example.com. If you search "site:vyteo.com book" you'll see it: i.imgur.com/4KD49jJ.png
    – Vyteo
    Commented Jul 27, 2017 at 21:14

1 Answer 1

3

The first comment suggests I should figure out how to disable the URL guess feature in WordPress. I think that is the best solution. One way to do so is answered here.

https://wordpress.stackexchange.com/questions/92103/disable-wordpress-url-auto-complete

remove_filter('template_redirect', 'redirect_canonical'); 

But it comes with admonitions on reasons you shouldn't, as this disables the entire feature which comes with many SEO benefits, such as preventing duplicate URL penalties. The part of it I don't want is:

Will also attempt to find the correct link when a user enters a URL that does not exist based on exact WordPress query. Will instead try to parse the URL or query in an attempt to figure the correct page to go to.

Apparently there's an open WordPress ticket on it. A workaround can be found here, as well as a similar one in the above link.

https://core.trac.wordpress.org/ticket/16557

function remove_redirect_guess_404_permalink( $redirect_url ) {
if ( is_404() )
    return false;
return $redirect_url;
}
add_filter( 'redirect_canonical', 'remove_redirect_guess_404_permalink' );
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.