开发者

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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜