Hello,

The question is this:

How to make a mod rewrite redirect from subdomain.site.ru/$1 to www.site.ru/$1 under the condition that the redirect will work if the requested page is not / need /? That is, if the appeal to the page / need /, then we remain on the subdomain, and in other other cases, go to www.site.ru/$1?

I tried differently, but basically I had a 500 error due to the lack of knowledge. :(

Thank you very much!

    2 answers 2

    I hope you have in the first line htaccess code

    RewriteEngine On 

    You can do so Redirect /ssilka.php http://site.ru

      May not be relevant)

      If I understand the question correctly, then maybe this will help. I redirect all requests for site.ru to the folder / folder /, only if the folder / itself is not requested, i.e. eliminated looping.

       RewriteEngine on RewriteCond %{REQUEST_URI} !/folder/ RewriteRule ^(.*)$ http://site.ru/folder/$1 [L,R=301] 

      Therefore, in your case something is required in the form:

       RewriteCond %{REQUEST_URI} !/need/ RewriteRule ^(.*)$ http://site.ru/$1 [L,R=301]