svgmx5 Posted April 27, 2010 Share Posted April 27, 2010 Hi everyone, i'm having an issue, i a user to automatically be re-directed to an https link from an http link... so if the user types in www.domainname.com/admin they are automatically re-directed to https://www.domainname.com/admin I've done this before, and i've managed to make it to work, but i can't get it to work on this server...dont' know if its because the server is a windows and not a linux server Anyway, here's the code that i'm using on the .htaccess file RewriteEngine On RewriteCond %{HTTPS} on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} Quote Link to comment https://forums.phpfreaks.com/topic/199987-automatically-re-sending-the-user-to-an-https-link/ Share on other sites More sharing options...
roopurt18 Posted April 27, 2010 Share Posted April 27, 2010 The rule you've provided says "If HTTPS protocol is ON, then redirect to HTTPS." You want a rule that says "If HTTPS is OFF, then redirect to HTTPS." Such a rule is: RewriteCond %{HTTPS} !on RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} Quote Link to comment https://forums.phpfreaks.com/topic/199987-automatically-re-sending-the-user-to-an-https-link/#findComment-1049656 Share on other sites More sharing options...
svgmx5 Posted April 27, 2010 Author Share Posted April 27, 2010 I did that already, and i still not getting it to work, nothing is happening, and its not re-directing Quote Link to comment https://forums.phpfreaks.com/topic/199987-automatically-re-sending-the-user-to-an-https-link/#findComment-1049657 Share on other sites More sharing options...
svgmx5 Posted April 28, 2010 Author Share Posted April 28, 2010 Like i said, i know i've done it before, but they all been on linux server with godaddy and this is a windows server.. Would that make a difference? Quote Link to comment https://forums.phpfreaks.com/topic/199987-automatically-re-sending-the-user-to-an-https-link/#findComment-1049658 Share on other sites More sharing options...
roopurt18 Posted April 28, 2010 Share Posted April 28, 2010 Nope. I do it all the time. Maybe something else in the syntax is wrong. Try turning on RewriteLog and RewriteLogLevel. Quote Link to comment https://forums.phpfreaks.com/topic/199987-automatically-re-sending-the-user-to-an-https-link/#findComment-1049667 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.