Here’s a php code snippet to force the page to https instead of http. You can use a self-signed SSL certificate on your OS X testing server.
// force redirect to SSL secure page
if($_SERVER[‘SERVER_PORT’] != ‘443’) { header(‘Location: https://’.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’]); exit(); }
Sorry, I am a new to Terminal. Can you tell me which file this is? I am trying to force http to https redirect on Leopard Server and I have yet to find out which file it is. Any help would be very much appreciated. Thanks!
Hi Preston —
You would need to add this PHP code snippet to the top of the .php page you are working with. It doesn’t have to do with Terminal. Just add it to the top of your xyz.php page.