My site currently uses http and https sections based on the data being collected on the site (form data uses https).
On my index page, I have the PHP code at the top:
<?php
session_start();
ob_start();
if( $_SERVER['SERVER_PORT'] == 443) {
header('Location:http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']));
die();
}
?>
However, the page will not load and I get a 404 error. Similarly, when i visit the sections with https security using the head code:
<?php
session_start();
ob_start();
if( $_SERVER['SERVER_PORT'] == 80) {
header('Location:https://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/'.basename($_SERVER['PHP_SELF']));
die();
}
?>
The site does not respond AND for some reason creates a double slash when switching from http to https.
Example: http://www.abc.com/, then clicking button which should route to enroll.php shows http://www.abc.com//enroll.php
why the need for the double slash and can anybody help with the 404 errors?