F
F
Fagi2019-05-31 05:41:01
htaccess
Fagi, 2019-05-31 05:41:01

How to make such a redirect?

There are four domains: site.ru, www.site.ru and site.su, www.site.su.
How to make a redirect from ru domain to su, taking into account www as well?
The option for the htaccess file is suitable. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Crash XD, 2019-05-31
@crashxd

On site.ru you redirect to site.su
On www.site.ru you redirect to www.site.su
.htaccess:

<IfModule mod_rewrite.c>
  RewriteEngine On
        RewriteCond %{HTTP_HOST} ^site.ru$ [NC]
  RewriteRule ^(.*)$ https://site.su/$1 [R=301,L]
</IfModule>
<IfModule mod_rewrite.c>
  RewriteEngine On
        RewriteCond %{HTTP_HOST} ^www.site.ru$ [NC]
  RewriteRule ^(.*)$ https://www.site.su/$1 [R=301,L]
</IfModule>

V
Viktor Taran, 2019-05-31
@shambler81


RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+\).ru$ [NC]
RewriteRule ^(.*)$ https ://%1.su/$1 [R=301,L]
ps
no state

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question