Jump to content

Redirecting entire site over HTTPS


mummana

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.)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.