映射一个二级域名到子目录使用mod_rewrite [英] Mapping a secondary domain to a subdirectory using mod_rewrite
问题描述
我期待映射二级域名到子文件夹在我的文档根目录。
I am looking to map a secondary domain to a subfolder on my document root.
例如,如果请求域 www.example.com
映射到我的DocumentToot,然后请求到 www.exampletwo.com
到 /网站/文件/
。
For example, if requests to the domain www.example.com
map to my DocumentToot, then requests to www.exampletwo.com
go to /sites/files/
.
我无法完成从 www.exampletwo.com/index.html
重定向到 www.exampletwo.com/sites/files/的index.html
同时使URL仍然显示 www.exampletwo.com/index.html
。任何想法?
I am unable to accomplish a redirect from www.exampletwo.com/index.html
to www.exampletwo.com/sites/files/index.html
while making the URL still display www.exampletwo.com/index.html
. Any ideas?
推荐答案
我相信你正在寻找的东西是这样的:
I believe you're looking for something like this:
RewriteCond %{HTTP_HOST} ^(www\.)?exampletwo\.com [NC]
RewriteRule ^/(.*) /sites/files/$1 [L]
这篇关于映射一个二级域名到子目录使用mod_rewrite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!