Question

So this is happening when I test my website using Facebook's Open Graph Object Debugger:

enter image description here

It doesn't like the trailing numbers after the profile page. But I have both of these defined properly:

<meta property="og:url" content="http://www.website.com/profile/139">
<link rel="canonical" href="http://www.website.com/profile/139">

I've tried for hours and it just keeps redirecting to the homepage:

enter image description here

Is there anything I can add to my .htaccess file or PHP header to prevent this 301 redirect?

May be related to the way Facebook/Google handle URL parameters: http://gohe.ro/1fpOA0N

Était-ce utile?

La solution

The anser was a problem with our domain host WP Engine, who tricks spiders into ignoring pure numeric strings at the end of page URL's. Pertains specifically to:

  • Googlebot (Google's spider)
  • Slurp! (Yahoo's spider)
  • BingBot (Bing's spider)
  • Facebook OG/Debugger

For example, the following URL:

http://www.website.com/profile/12345

Will be interpreted to these bots as:

http://www.website.com/profile

However, if the string is non-numeric the bots will recognize it. This is done for caching purposes. But again, this pertains only to WP Engine and a few other hosting providers.

Autres conseils

Facebook treats the og:url Meta Tag as the Canonical for your page:

<meta property="og:url" content="http://www.yoursite.com/your-canonical-url" />

If your Canonical url is redirecting you are in fact creating a loop. Don't redirect from your Canonical. Canonical is the page which should be considered the better option for the spiders. If a page has a Canonical url tag it means that it is NOT the best/default page but rather it is a lesser variation of the Canocical.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top