I wrote a .htaccess which redirects all subdomains to the / sub / directory. Now this problem has appeared:

if I enter www.site.ru it redirects to the directory / sub / it should not www redirect how can I fix this?

RewriteCond %{HTTP_HOST} ^([^\.]+)\.site\.com$ RewriteCond %{REQUEST_URI} !/sub/ RewriteRule ^(.*)$ /sub/$1 [L] 

    1 answer 1

     RewriteCond %{HTTP_HOST} ^(?:www\.)?((?!www).+)\.site\.ru$ RewriteCond %{REQUEST_URI} !/sub/ RewriteRule ^(.*)$ /sub/$1 [L]