: Excluding Facebook Crawler From Following Htaccess Redirects? I recently made my website https and it's previous url (http) had many Facebook likes which I would like to migrate to the new https
I recently made my website https and it's previous url (http) had many Facebook likes which I would like to migrate to the new https url. The only change to the url was the https, no domain change or anything else.
I followed the migration steps advised by Facebook but ran into the following errors (according to developers.facebook.com's Open Graph Object Debugger):
Critical Errors That Must Be Fixed.
Could Not Follow Redirect Path.
Using data from www.myurl.com because there was an error following the redirect path.
Errors That Must Be Fixed.
Circular Redirect Path.
Circular redirect path detected (see 'Redirect Path' section for details).
Could Not Follow Redirect.
URL requested a HTTP redirect, but it could not be followed.
To find the object, these are the redirects we had to follow.
original www.myurl.com 302 www.myurl.com og:url www.myurl.com
I have no idea how to fix this. Obviously because of the http to https change I have a 301 redirect from http to https on my .htaccess which I think is what is causing the problem. Any ideas folks?
Update...
It appears like what I need to do is exclude Facebook's crawler (how do I identify that?) from following my www.myurl.com to www.myurl.com redirect. My .htaccess file looks like this at the moment...
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/contact-us.php
RewriteRule ^ %{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTPS} on
RewriteRule ^contact-us.php %{HTTP_HOST}/contact-us.php [NC,L,R=301]
I have http to https redirected with exception of one php page. But how do I exclude Facebook's crawler from automatically going to https?
More posts by @Miguel251
1 Comments
Sorted by latest first Latest Oldest Best
You need to disable the 301 redirect when Facebook's crawler crawls the site. Jon Lin says on StackOverflow:
This question addresses the user-agent that facebook external hits will look like. You just need to add a condition to check for it:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9]
RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI}
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.