Answer the question
In order to leave comments, you need to log in
How to pass a subdomain name using .htaccess to a script without overwriting other parameters?
I make virtual subdomains with
RewriteCond %{HTTP_HOST} ^test\.example\.com$
RewriteCond %{REQUEST_URI} (.*)/$
RewriteRule ^(.*)$ ?sub=test [L]
RewriteCond %{HTTP_HOST} ^demo\.example\.com$
RewriteCond %{REQUEST_URI} (.*)/$
RewriteRule ^(.*)$ ?sub=demo [L]
RewriteCond %{HTTP_HOST} ^test\.example\.com$
RewriteCond %{REQUEST_URI} (.*)/$
RewriteRule ^(.*)$ ?sub=test&%{QUERY_STRING} [L]
http://test.example.com/?q1=1&q2=2
в
http://example.com/?sub=test&?q1=1&q2=2
[subaction] => userinfo
[user] => admin
[test] => test
RewriteRule ^user/([^/]*)(/?)+$ index.php?subaction=userinfo&user=$1 [L]
[subaction] => userinfo
[user] => admin
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question