使用 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
的请求转到 /sites/files/
.
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屋!