RewriteCond %{HTTP_HOST} ^(.+). site.ru $ [NC] RewriteCond %{HTTP_HOST} !^ www.site.ru $ [NC] RewriteCond %{REQUEST_URI} !^/page.php RewriteRule ^(.*) %{HTTP_HOST}$1 RewriteRule ^(.*). site.ru /page.php?id=$1 

The rules are working, everything is ok. But there was a problem to make a subdomain:

 RewriteRule ^ poddomen.site.ru/(.*)/$ /somepage.php?id=$1 [L] 

Although the rule is set, the script /page.php?id=$1 still happens

Is there any way to fix it? Just reluctant to write a crutch in the page.php file

    1 answer 1

    The last rule is written at the end? If yes, then the rule is triggered.

     RewriteRule ^(.*). site.ru /page.php?id=$1 

    Try moving higher. And for good server should deal with such matters