Jump to content

Recommended Posts

 

Hi,

 

We want to redirect all page over HTTPS in the site.

 

1.) It works fine when we requet with http://mysite.com, it redirects to https://mysite.com/home/login.jsp.

 

RewriteCond %{HTTP_HOST} mysite.com [NC]

RewriteCond %{HTTPS} !on

RewriteRule .* https://mysite.com/home/login.jsp [R=301]

 

2.) The issue is, when we request with https://mysite.com it not redirecting to https://mysite.com/home/login.jsp and it is hanging the request.

 

 

Could you please help me here.

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/147035-redirecting-entire-site-over-https/
Share on other sites

The rewrite cond will make the rewrite rule execute only if https is not currently "on."

 

 

So, you could just do something like:

 

 

RewriteRule ^$ /home/login.jsp [R=301]

 

(There is most likely a better way than doing a rewrite, but I can't think of it right now.  Also, that 301 means that it's a "permanent" redirect, so if you actually plan on using / you should change that.)

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.