Answer the question
In order to leave comments, you need to log in
Problems with .htaccess: incorrect directory handling?
Tell me, what is the problem that my rules do not work?
It is necessary that the subdomain works with the subdirectory of the site as with the root one: going to the address sms-rassilka-barnaul.sitename.ru should open the directory /cities/barnaul/*
And so for many cities.
Previously, it was prescribed forcibly:
RewriteCond %{HTTP_HOST} ^(www\.)?sms-rassilka-barnaul\.sitename\.ru$ [NC]
RewriteCond %{REQUEST_URI} !^/cities/barnaul/ [NC]
RewriteRule ^(.*)$ /cities/barnaul/$1 [L,QSA]
RewriteCond %{HTTP_HOST} sms-rassilka-([a-z]+)\.sitename\.ru$ [NC]
RewriteCond %{REQUEST_URI} !^/cities/%1/ [NC]
RewriteRule ^(.*)$ /cities/%1/$1 [L,QSA]
Answer the question
In order to leave comments, you need to log in
Decided! The correct code is this:
RewriteCond %{HTTP_HOST} ^sms-rassilka-([a-z]+)\.sitename\.ru [NC]
RewriteRule ^((?!cities/.*).*)$ /cities/%1/$1 [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question