嵌套子域 URL 重写
我看到的格式如下:
nested_subdomain1.nested_subdomain2.domain.com
它可能类似于 test.users.domain.com,我希望能够将此 URL 重写为 test.users .domain2.com。
到目前为止,我的运气还不好,我还没有能够从网上找到的示例成功实现可行的解决方案。我尝试过如下一些事情:
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule (.*) http://domain2.com/$1 [R=301,L]
或者这个......
RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://fully.qualified.domain.name/$1 [L,R]
我不确定我做错了什么,感觉我错过了一些非常明显的东西。
I have a sight that is of the following form:
nested_subdomain1.nested_subdomain2.domain.com
It might be something like test.users.domain.com and I would like to be able to rewrite this URL to something like test.users.domain2.com.
So far, my luck has not proven well and I have not been able to successfully implement a working solution from examples found online. I have tried some things like the following:
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule (.*) http://domain2.com/$1 [R=301,L]
Or this one...
RewriteCond %{HTTP_HOST} !^fully\.qualified\.domain\.name$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://fully.qualified.domain.name/$1 [L,R]
I am not sure what I am doing wrong and feel like I am missing something really obvious.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个
Try this
这会将 xx.yy.mydomain.com 转移到 mydomain.com/xx.yy
要替换为斜杠,请尝试
转移到另一个域,尝试
这会将子域转移到三级。坦率地说,您必须分析 index.php 中的主机以确定调用哪个子域,因此不妨使用第一个
This will trasnfer xx.yy.mydomain.com to mydomain.com/xx.yy
To replace with slashes, try
To transfer to another domain ,try
This will transfer the subdomains upto a level of three. Frankly, you will have to analyze the host in your index.php to determine which subdomain is caled, so might as well use the first one