Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/137489-mod_rewrite-rule/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/137489-mod_rewrite-rule/#findComment-718576
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.