Hello!
I have a rule in .htaccess whereby all routes with the .ru domain should be redirected to the same routes only with the .com domain

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

In principle, everything is OK here, except for one - I need to add an exception for one (in the future maybe several) pages. How to do it right?

    1 answer 1

     RewriteCond %{HTTP_HOST} ^domain.ru RewriteCond %{REQUEST_URI} !^/news/1/ RewriteCond %{REQUEST_URI} !^/news/2/ RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^www.domain.ru RewriteRule ^(.*)$ http://domain.ru/$1 [R=301,L] 

    Addresses have a look

     http://domain.ru/news/1/ http://domain.ru/news/2/ http://www.domain.ru/news/1/ http://www.domain.ru/news/2/ http://domain.ru/news/1/привет-мир http://domain.ru/news/2/вторая-новость/ 

    will not be redirected to .com .