Facebook is not redirecting to https when accessing tab URL
im having a facebook app which is hosted in https only. this is one of installed sample https://www.facebook.com/nintriva?sk=app_236578386381406 But what my problem开发者_运维知识库 is that when im accessing the url from http it is not showing anyhtng. Actually i need to the users to redirect to https when they are accing my app from their tab of fan pages.
I suppose you are using PHP with Apache, so you can easily do this by changing the settings of the server in the files .htaccess
or httpd.conf
.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Alternatively you can do this by sending a redirection header through PHP. This has to be done before any actual output is sent.
<?php
// Ensure the request goes through HTTPS
if (!$_SERVER['HTTPS']) {
header("HTTP/1.1 301 Moved Permanently");
header('Location: https://your-app');
exit;
}
// Do the other stuff
精彩评论