Apache 重定向问题 - mod_rewrite 或 mod_alias
我有一个特定的需求:
example.com/store/{location} 必须重定向到 example.com/store2/{location}
这需要重定向,而不仅仅是网址“重写”,所以我猜我需要 mod_alias,正确的?有人愿意分享正确的代码吗?我对 mod_rewrite 和 mod_alias 都有点模糊。 (我希望我问得正确)谢谢!
I have a specific need:
example.com/store/{location} must redirect to example.com/store2/{location}
And this needs to redirect, not just a url 'rewrite', so I'm guessing I need mod_alias, right? Anyone care to share the correct code for it? I'm a little fuzzy with both mod_rewrite and mod_alias. (I hope I asked this correctly) Thanks!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想告诉浏览器重定向其位置,您只需使用
mod_alias
:如果您的意思是永久重定向,则可以使用以下内容:
至于您的困惑,mod_alias 基本上是 mod_rewrite 的简单版本。引用 GreyWyvern:
If you mean you want to tell the browser to redirect its location, you simply can do this with
mod_alias
:Or the following if you mean it's a permanent redirect:
As for your confusion, mod_alias is basically a simpler version of mod_rewrite. Quoting GreyWyvern: