可以使用 apache mod_rewrite 将 301 重定向到具有非“http”方案的 url和“https”?

发布于 2024-09-28 12:44:19 字数 533 浏览 2 评论 0原文

尝试使用 apache mod_rewrite 进行 301 重定向:

RewriteRule /the-path/(.*) my-scheme://new-site.com/the-path/$1 [R=301,NC,L]

路径 http://site.com/the-path /param1=xyz 将重定向到 http://site.com/my-scheme ://new-site.com/the-path/param1-xyz

但是当我在重写规则中使用“http”或“https”代替“my-scheme”时,它按预期工作。

所以我猜 mod_rewrite 只能重定向到“http”或“https”。任何人都可以确认吗?谢谢

Trying to do a 301 redirect using apache mod_rewrite:

RewriteRule /the-path/(.*) my-scheme://new-site.com/the-path/$1 [R=301,NC,L]

The path http://site.com/the-path/param1=xyz will redirect to
http://site.com/my-scheme://new-site.com/the-path/param1-xyz

But when I use "http" or "https" in place of "my-scheme" in the rewrite rule, it is working as expected.

So I guess mod_rewrite can redirect to only "http" or "https". Anyone can confirm? Thanks

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

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

发布评论

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

评论(1

轻许诺言 2024-10-05 12:44:19

不仅仅是“http:”或“https:”,而是 非常接近

Not just "http:" or "https:", but pretty close.

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