问题
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