This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) Disable any automatic http to https redirect on your proxy or hosting provider. Both http and https traffic should reach your .htaccess so you control redirects from there. | |
# 2) .htaccess should redirect facebook's bot to http, and everyone else to https. | |
RewriteEngine on | |
RewriteCond %{REQUEST_SCHEME} ^https$ | |
RewriteCond %{HTTP_USER_AGENT} facebookexternalhit/[0-9] | |
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
RewriteCond %{REQUEST_SCHEME} ^http$ | |
RewriteCond %{HTTP_USER_AGENT} !facebookexternalhit/[0-9] | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] |