Url redirection subdirectory to subdomain

夙愿已清 提交于 2019-12-06 13:20:28

问题


I am using php. and i want to redirect subdirectory to subdomain and subdirectory of subdirectory to subdomain directory.

For example : if i have url like http://www.test.com/test1/

then it should be redirect to http://test1.test.com/

and second if i have url like this http://www.test.com/test1/test2/

then it should be redirect to http://test1.test.com/test2/

Any one have idea how to do this.

Thanks in advance


回答1:


can do in .htaccess with something like..

RewriteEngine On
RewriteRule ^([^/]+)/(.*)$ http://$1.test.com/$2 [R,L]


来源:https://stackoverflow.com/questions/5013357/url-redirection-subdirectory-to-subdomain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!