URL重定向子目录子域 [英] Url redirection subdirectory to subdomain
本文介绍了URL重定向子目录子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的PHP。我想重定向子目录子域和子目录子目录子域目录。
I am using php. and i want to redirect subdirectory to subdomain and subdirectory of subdirectory to subdomain directory.
例如:如果我有URL如 http://www.test.com/test1/
For example : if i have url like http://www.test.com/test1/
那么它应该重定向到 http://test1.test.com/
和第二,如果我有URL像这样 http://www.test.com/test1/test2 /
and second if i have url like this http://www.test.com/test1/test2/
那么它应该重定向到 http://test1.test.com/test2/
任何一个有想法如何做到这一点。
Any one have idea how to do this.
在此先感谢
推荐答案
可以在.htaccess做类似的东西。
can do in .htaccess with something like..
RewriteEngine On
RewriteRule ^([^/]+)/(.*)$ http://$1.test.com/$2 [R,L]
这篇关于URL重定向子目录子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文