开发者

Facebook is not redirecting to https when accessing tab URL

开发者 https://www.devze.com 2023-04-12 19:13 出处:网络
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

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号