I am getting an error on a FB app when the url does not have the https or and has a www in the url. I am just going to strip the url of the www.
The code below adds the https if it is not in the url but how would I remove the www as well?
if(!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == ""){
$redirect = "https://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $redirect");
}
easiest way.
Try to do it using .htaccess
Here is a way to do it with your
.htaccess
withhttps
RewriteEngine
...On
https
is ...on
orwww