mod_rewrite 将主机重定向到另一个文件夹
我有一些域都重定向到同一个文件夹(我的 public_html)。我想编写一个 .htaccess 文件,将每个域发送到它自己的文件夹(因此不会在导航栏上显示它)。 例如,导航到 http://example.com 将加载文件夹 /public_html/example.com/<我的服务器的 /code>。
在另一个上下文中,我使用了以下代码:
RewriteCond %{HTTP_HOST} example\.com$ [NC,OR]
RewriteRule ^(.*)$ http://www.anotherdomain.com/$1 [R=301,L]
但现在我不想重定向到另一个域;我只想从不同的文件夹中获取文件...
可以实现吗?提前致谢。
I have some domains that all redirect to the same folder (my public_html). I'd like to write an .htaccess file that would send each domain to it's own folder (thus not displaying this on the navigation bar).
For example, navigating to http://example.com would load the folder /public_html/example.com/
of my server.
In another context, I've used this code:
RewriteCond %{HTTP_HOST} example\.com$ [NC,OR]
RewriteRule ^(.*)$ http://www.anotherdomain.com/$1 [R=301,L]
But now I don't want to redirect to another domain; I just want to fetch the files from a different folder...
Is it achievable? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将您拥有的内容替换为:
对于显式主机重定向:
Replace what you have with:
For explicit host redirects: