How To Make My Domain Automatically Redirect to https?

Status
Not open for further replies.

Brad100

Supreme Member
Joined
Nov 9, 2014
Messages
1,346
Reaction score
1,001
Hey guys, the title is pretty confusing, sorry about that. So, I got a SSL certificate for a site, I got everything working and installed the certificate on the site. But the problem is, when I put "mysite.net" in the address bar, it redirects to www.mysite.net but https:// does not show. But when I put "www.mysite.net" the https:// shows and so does the green lock. What am I doing wrong here?

ghh9nU8


ZMEJTI2
 
Refer this page i think it has a solution that u needed .
serverfault.com/questions/116206/how-do-i-use-htaccess-to-always-redirect-from-http-to-https
 
You need to redirect both www and non www versions to HTTPS. Currently, only the www version is being redirected to the https.

Are you good in htaccess?
 
Refer this page i think it has a solution that u needed .
serverfault.com/questions/116206/how-do-i-use-htaccess-to-always-redirect-from-http-to-https

Thanks, trying to figure it out now.
You need to redirect both www and non www versions to HTTPS. Currently, only the www version is being redirected to the https.

Are you good in htaccess?

the non www version is being automatically redirected to www, and since the www version is already redirecting to https, shouldn't the non-www version be auto redirected to https? And I'm not really good at htaccess, but doesn't seem too complicated, will try to figure it out and let you guys know If I need further assistance.

-Thanks.
 
UPDATE: It worked. I had to add the following code in my .htaccess :

Code:
RewriteEngine On
RewriteCond %{HTTPS} !^on$
RewriteRule (.*) https://www.mysite.net/$1 [R,L]


RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Thread closed, thank you for helping.
 
Status
Not open for further replies.
Back
Top