Answer the question
In order to leave comments, you need to log in
How to redirect from .ru domain to .com, but leave one directory available at .ru address?
there is a site xxx, it has 2 domains, xxx.ru and xxx.com, the main domain was xxx.com, you need to redirect from ru to com, but it's all simple, the main problem is that you need to leave the xxx directory available. ru/folder/, how to make such an exception?
Answer the question
In order to leave comments, you need to log in
RewriteEngine on
RewriteCond %{HTTP_HOST} ru$
RewriteCond %{REQUEST_URI} !^/folder/?
RewriteRule (.*?) http://xxx.com/$1 [NC,L,R=301]
The rules are now:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site.ru$
RewriteCond %{REQUEST_URI} !^/lp/?
RewriteRule (.*?) http://site.com/$1 [R=301,L]
# редирект /news/123 -> /news/123/
RewriteCond %{REQUEST_URI} ^(.*/[^/\.]+)$
RewriteRule ^(.*)$ /$1/ [R=301,L]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question