开发者

redirect username to subdomain

i need to a script that it can do it

blogname.d开发者_如何学编程omain.com = > http://www.domain.com/blogname/

i think it possible with .htaccess file but i dont know it, so help me

thanks alot


In .htaccess you can do the following

RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^[^.]+\.domain\.com$
RewriteRule   ^(.+)                        %{HTTP_HOST}$1          [C]
RewriteRule   ^([^.]+)\.domain\.com(.*)    http://www.domain.com/$1$2

This rewrites http://username.domain.com/anypath
internally to http://www.domain.com/username/anypath

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜