D
D
Dmitry Glazkov2020-08-03 00:42:07
htaccess
Dmitry Glazkov, 2020-08-03 00:42:07

How to redirect from multiple domains to one?

There are 4 domains. One main and 3 additional. It is necessary to make a 301 redirect from them to the main one.
Note 1: all without www
Note 2: with https
Note 3: two of the three home domains are

Cyrillic

RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.ru [OR]
RewriteCond %{HTTP_HOST} ^кириллический1.XN--P1AI [OR]
RewriteCond %{HTTP_HOST} ^кириллический2.XN--P1AI
RewriteRule ^(.*)$ https://mainsite.ru/$1 [R=permanent,L]


Relay works only from site.ru to https://mainsite.ru/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-08-03
@dbglazkov

RewriteCond %{HTTP_HOST} ^(www\.|)9918474\.ru$     [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.|)site4top\.ru$    [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.|)sunnyfruits\.ru$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.|)u-kit\.ru$       [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.|)mediagrup\.ru$   [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.|)vmast\.ru$       [NC,OR]
RewriteCond %{HTTP_HOST} ^(www\.|)desid\.ru$       [NC]
RewriteRule ^(.*)$ https://klondike-studio.ru/  [R=301,L]

Don't forget to escape the dot.
in order to make these redirects, you do not need to create sites, just add aliases to the main site
5f27c6f1b9337924887753.png
and enter all the rules in its htaccess.
This will allow you not to create a bunch of sites with different htaccess, and yes, then this syntax will be enough for you.
If you already have sites, then all the rules should be in each site in its .htacess

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question