如何将某些请求重定向到另一个域?
我建立了一个网站并更改了旧网站的名称。因此暂时有 2 个站点正在运行。
- www.mydomain.com(新站点)
- legacy.mydomain.com(旧站点)
问题是仍然有一些流量错误地到达新站点,我不希望我的 Rails 应用程序处理这个问题(rails 有点慢并且需要大量资源)。 相反,我希望 apache 在到达 Rails 应用程序之前将其重定向到旧的。
错误的流量网址总是类似于“www.mydomain.com/bbs/...”。所以我想过滤掉带有'/bbs/'的请求并将其重定向到“legacy.mydomain.com/bbs/...”。我想我可以在我的 .htaccess 文件上做到这一点。但我不知道如何写规则。 mod_rewrite 安装在我的服务器上。
你能帮忙吗? 谢谢。
山姆
I set up a site and changed the old site's name. So temporarily 2 sites are running.
- www.mydomain.com (new site)
- legacy.mydomain.com (old site)
The problem is that still some traffic comes to the new site mistakenly and I don't want my rails application to handle that (rails is kinda slow and takes lotta resources).
Instead, I want apache to redirect it to the old one before it reaches to the rails app.
The wrong traffic url is always like "www.mydomain.com/bbs/...". So I want to filter out requests with '/bbs/' and redirect it to "legacy.mydomain.com/bbs/...". I think I can do that on my .htaccess file. But I don't know how to write the rule. mod_rewrite is installed on my server.
Can you help?
Thanks.
Sam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试:
Try: