Htaccess 重定向

发布于 2024-10-01 22:52:55 字数 395 浏览 0 评论 0原文

大家好,我正在将网站迁移到具有不同 URL 结构的新 CMS,如果链接的特定部分丢失,我希望让用户重定向。因此,如果用户访问 www.domain.com/articles/name_of_article,它会将他们带到旧网站,但是如果他们访问 www.domain.com/,它会将他们转发到子目录 http://beta.domain.com 因此,我想要实现的目标是让旧 URL 保持活动状态,以免丢失旧链接的流量,因为由于旧 CMS 的编码方式,不可能迁移这些链接。但会提示用户移至新站点当他们登陆这些页面时。

如何通过 htaccess 来完成此操作,任何提示将不胜感激?

问候并感谢您的帮助!

Hey folks, I'm migrating a website over a to new CMS with a different URL structure, I'd like to have users redirect if a specific part of the link is missing. So if the user goes to www.domain.com/articles/name_of_article it'll take them to the old site, however if they go to www.domain.com/ it'll forward them to the subdirectory http://beta.domain.com
So what I'm trying to accomplish is to leave the old URLs active as to not lose traffic from old links since migrating those links is impossible because of how the old CMS was coded..but prompt the user to move over to the new site when they land on those pages.

how can this be accomplished via htaccess, any tips will be greatly appreciated?

Regards and thank you for your help!

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

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

发布评论

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

评论(1

东北女汉子 2024-10-08 22:52:55
RewriteEngine on
RedirectMatch ^/$ http://beta.domain.com/

做到了

...答案比问题简单多了哈哈

RewriteEngine on
RedirectMatch ^/$ http://beta.domain.com/

did it

...The answer was a lot simpler than the question hah

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文