简单的 .htaccess 子域重写
我知道这里有很多关于此的问题......但现在我感觉就像一头被迎面而来的车灯惊呆的鹿......我只是不知道从哪里开始以及选择哪个选项。
我的要求很简单。
用户转到 http://application.domain.com 或 http://www.application.domain.com 这些文件的真实位置是 http://www.domain.com/application
显然这需要使用通配符来完成,以便任何域(即使它不存在)触发重写。
我希望这对某人有意义
编辑: 我还应该提到我已将通配符 A 记录添加到 Cpanel *.domain.com 中的 DNS 条目
谢谢
Tim
I know there is a lot of questions on here about this... but right now I feel like a deer stunned by oncoming headlights... I just don't know where to start and which option to choose.
My requirements are simple.
User goes to http://application.domain.com or http://www.application.domain.com and the real location of these files is http://www.domain.com/application
Obviously this needs to be done using wildcards so that any domain (even if it doesn't exist) triggers the rewrite.
I hope this makes sense to someone
EDIT:
I should also mention I have added the wildcard A record to my DNS entries in Cpanel *.domain.com
Thanks
Tim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将这个问题发布到 serverfault.com 上,icyrock 解决了它。如果其他人想知道这里给出的答案:
https://serverfault .com/questions/203780/troubleshooting-a-htaccess-wildcard-subdomain-rewrite/203804#203804
蒂姆
I posted this question onto serverfault.com and icyrock solved it. Incase anyone else is wondering the answer given is here:
https://serverfault.com/questions/203780/troubleshooting-a-htaccess-wildcard-subdomain-rewrite/203804#203804
Tim
.htaccess 中最简单的方法是将以下内容放入 htaccess 文件中尽可能高的层次结构中。
Simplest way in .htaccess would be to put the following in an htaccess file as high up in the hierarchy as possible.