# subdomain
RewriteCond %{HTTP_HOST} !www.site.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).site.com [NC]
RewriteRule (.*) st.php?crt_dealer=%2 [nc,qsa]
# subdomain 2
RewriteCond %{HTTP_HOST} !www.site.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).site.com/search/ [NC]
RewriteRule (.*) list.php?crt_city=%2 [NC,QSA]# https://city.site.com/search/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^search/$ list.php?crt_city=%1 [L,QSA]
# https://city.site.com/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^$ st.php?crt_dealer=%1 [L,QSA] чтобы название субдомена, образно msk.site.com, подставлялся в параметр crt_city, чтобы в реальности получилось msk.site.com/search/?crt_city=msk, как это можно поправить?
list.php?crt_city=%1 тут в переменную %1 попадает msk. var_dump($_SERVER['QUERY_STRING']); в файле list.php чтобы понять что же на самом деле получает скрипт.[L,QSA] это внутреннее перенаправление которое никак не меняет адресную строку в браузере. RewriteRule ^search/?$ list.php [nc,qsa]
RewriteRule ^search/([^/]+)(?:/?([^/]*)/?([^/]*)/?)? /list.php?category_slug=$1&oblast_slug=$2®ion_slug=$3 [L,QSA]
RewriteCond %{REQUEST_URI} ^(.*)(/list.html)(.*)$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) ./list.php?$1 [QSA]# https://city.site.com/search/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^search/$ list.php?crt_city=%1 [L,QSA] RewriteRule ^search/?$ list.php [nc,qsa]
# https://city.site.com/search/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^search/$ list.php?crt_city=%1 [L,QSA]^search/$ уже никогда не сможет совпасть. RewriteRule ^search/?$ list.php [nc,qsa]
RewriteRule ^search/([^/]+)(?:/?([^/]*)/?([^/]*)/?)? /list.php?category_slug=$1&oblast_slug=$2®ion_slug=$3 [L,QSA]# https://city.site.com/search/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^search/?$ list.php?crt_city=%1 [L,QSA]
RewriteRule ^search/([^/]+)(?:/?([^/]*)/?([^/]*)/?)? /list.php?category_slug=$1&oblast_slug=$2®ion_slug=$3 [L,QSA] # https://city.site.com/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^$ st.php?crt_dealer=%1 [L,QSA]# https://city.site.com/search/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^search/$ list.php?crt_city=%1 [L,QSA]# subdomain
RewriteCond %{HTTP_HOST} !www.site.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).site.com [NC]
RewriteRule (.*) st.php?crt_dealer=%2 [nc,qsa]
# subdomain 2
RewriteCond %{HTTP_HOST} !www.site.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).site.com [NC]
RewriteRule (.*) list.php?crt_city=%2 [NC,QSA] # city subdomain
RewriteCond %{HTTP_HOST} !www.site.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).site.com [NC]
RewriteRule (.*) list.php?crt_city=%2 [NC,QSA]
# https://city.site.com/
RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
RewriteRule ^user/$ st.php?crt_dealer=%1 [L,QSA]if(isset($_GET['crt_city']) && $_GET['crt_city'] && !$city) {
global $config_live_site;
header("Location:"."https://".$crt_city.".site.com"."/user/"); exit(0);
}# city subdomain
RewriteCond %{HTTP_HOST} !www.site.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).site.com [NC]
RewriteRule (.*) list.php?crt_city=%2 [NC,QSA]# https://city.site.com/search/
#RewriteCond %{HTTP_HOST} ^(?>www\.|)([\w-]+)\.site\.com$ [NC]
#RewriteRule ^$ list.php?crt_city=%1 [L,QSA]