Home How to redirect from www to https www with htacces?
Reply: 0

How to redirect from www to https www with htacces?

user743
1#
user743 Published in June 20, 2018, 7:40 am

I need to do the following: My current address looks like: https://www.domain.com

I want to redirect with htaccess: www.domain.com TO https://www.domain.com and http://domain.com TO https://www.domain.com

I've tried with some suggestions here, but it ended up with the endless loop. I tried:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^(.*)$ https://www.domain.com/$1 [L,R=301]

Any help would be appreciated.

UPDATE: I think I've done it with the following:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R=301,L]

Is that the right way to do it?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.351782 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO