pratkal Posted August 1, 2011 Share Posted August 1, 2011 Hi i need a php script for my website which should do the followingif a user try to visit http://mywebsite.com or www.mywebsite.com php find the url and redrict the user to https://mywebsite.com Thanks Link to comment Share on other sites More sharing options...
JamesB Posted August 1, 2011 Share Posted August 1, 2011 try putting this in index.php in the root folder of your site running on http: <?phpheader('Location: https://mywebsite.com');?> Link to comment Share on other sites More sharing options...
Ingolme Posted August 1, 2011 Share Posted August 1, 2011 You'll want to detect if the server is running in HTTPS first. <?phpif(empty($_SERVER['HTTPS'])) { header('Location: https://mywebsite.com');}?> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.