mummana Posted December 18, 2008 Share Posted December 18, 2008 Hi, I want to redirect from HTTP to HTTPS login page . It works correclty, when I request with http://test.com, it redirects http://test.com/home/login.jsp RewriteCond %{HTTP_HOST} test.com [NC] RewriteCond %{HTTPS} !on RewriteRule .* test.com/home/login.jsp [R=301] But when I request with https://test.com, it is not redirecting to the home page. Could you please help me regarding. Thanks Srini Quote Link to comment https://forums.phpfreaks.com/topic/137489-mod_rewrite-rule/ Share on other sites More sharing options...
kevintynfron Posted December 18, 2008 Share Posted December 18, 2008 Hi Srini The rewrite rule you've given won't work for https because the second line checks that it is not encrypted. in pseudo-code, you've got: if the requested host contains "test.com" ignoring case AND it is not an encrypted connection then re-write to the login page with a permanent redirect I'm having problems of my own along these lines, so I'm not really in a position to give you the answer. I do have a couple of suggestions/questions, though. 1. you'll need to re-write to https to make it use the encrypted connection.current encryption RewriteCond %{HTTP_HOST} test.com [NC] RewriteRule .* https://test.com/home/login.jsp [R=301] 2. As it stands, this rule will surely re-write for any and all requests that come to test.com domain - graphics, html, flash, everything will get redirected to the login. Once you've logged in, any other page will be re-directed to the login script. Sorry for not having a definitive answer. Kevin Quote Link to comment https://forums.phpfreaks.com/topic/137489-mod_rewrite-rule/#findComment-718576 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.