Htaccess 规则将整个站点移动到文件夹中?

发布于 2024-09-09 00:37:13 字数 330 浏览 1 评论 0原文

我在 httpdocs 中有两个文件夹,

site_v1
site_v2

我想将整个域重定向到 site_v2,但也保留对此的引用,

这样就可以工作

www.example.com -> gets into site_v2
www.example.com/site_v1/ -> gets into site_v1
www.example.com/site_v2/ -> gets into site_v2

这种重定向的 htaccess 指令如何?

I have two folders in httpdocs

site_v1
site_v2

I would like to redirect the entire domain to site_v2 but also to keep reference to this

so this would work

www.example.com -> gets into site_v2
www.example.com/site_v1/ -> gets into site_v1
www.example.com/site_v2/ -> gets into site_v2

How would be the htaccess directives for this kind of redirect?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

滥情稳全场 2024-09-16 00:37:13

试试这个规则:

RewriteCond $0 !^(site_v1|site_v2)($|/)
RewriteRule .* site_v2/$0 [L]

Try this rule:

RewriteCond $0 !^(site_v1|site_v2)($|/)
RewriteRule .* site_v2/$0 [L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文