R
R
ruHunterNic2016-07-21 11:39:41
htaccess
ruHunterNic, 2016-07-21 11:39:41

How to redirect to https only for a specific domain?

Tell me, there is a rule for redirecting from http to https. but because CMS system is used, then several domains are specified and directed to one folder. And not everyone is certified. And everyone is moving.
How can I make this rule work only for a specific domain?

RewriteEngine On
RewriteCond %{HTTP:X-HTTPS} !1
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-07-21
@ruHunterNic

It seems like it should work:

RewriteEngine On
RewriteCond %{HTTP:X-HTTPS} !1
RewriteCond %{HTTP_HOST} ^cms1.domain.ru$
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question