S
S
s_katala2017-01-29 16:58:55
htaccess
s_katala, 2017-01-29 16:58:55

How to redirect to https and www in htaccess?

Can you tell me how to make the site open like this?
https://www.domain.com
I do this, but it works both with www and without www, but only with www and https

RewriteCond %{SERVER_PORT} ^80$ [OR]
RewriteCond %{HTTP} =on
RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy Orlov, 2017-01-30
@s_katala

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

will redirect http :// www . site. com to https://www. site. com
but not http :// site . com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question