Help with htaccess redirect for subdomain
I'm using this code to redirect all subdomains to the subdomain folder. For example test.site.com => s开发者_Python百科ite.com/test.
RewriteCond %{HTTP_HOST} !^www\.site\.com [NC]
RewriteCond %{HTTP_HOST} ([^.]+)\.site\.com [NC]
RewriteRule ^(.*)$ http://site.com/%1 [L]
When I visit test.site.com it automatically redirects to the folder test/.I want to stay at the domain test.site.com and show the contents of test/ folder without redirecting to the actuall folder.Thanks.
You could do achive that with this code:
RewriteCond %{HTTP_HOST} !^www\.site\.com [NC]
RewriteCond %{HTTP_HOST} ([^.]+)\.site\.com [NC]
RewriteRule ^(.*)$ /%1/$1 [L]
精彩评论