mod_rewrite 还是 mod_alias?

发布于 2024-07-19 05:06:53 字数 250 浏览 3 评论 0原文

我有一个服务器,它的 httpd.conf 中已经有一些“RedirectMatch permanent”指令。

我对 mod_alias 不太熟悉,我只使用过 mod_rewrite 。

基本的区别是什么? 我在 mod_alias 中没有看到用于停止处理规则的“L”标志。

我应该使用哪一个来实现从一个子域重定向到另一个子域的最佳实践?

我可以同时使用两者吗?哪个优先会很明显吗?

I have a server, its httpd.conf already has some "RedirectMatch permanent" directives in it.

I'm not that familiar with mod_alias, I've only ever used mod_rewrite.

What's the basic difference? I don't see a "L" flag in mod_alias to stop processing rules.

Which one should I use for best practices of redirecting from one sub-domain to another?

Can I use both at the same time and will it be obvious which takes precedence?

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

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

发布评论

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

评论(2

mod_alias 基本上是 mod_rewrite 的简单版本。 它无法执行 mod_rewrite 可以执行的某些操作,例如操作查询字符串。 如果您能够选择其中任何一个,我看不出您有任何理由要使用 mod_alias。

您需要尝试同时使用两者有什么具体原因吗?

Apache mod_rewrite & mod_alias 技巧你应该知道 似乎是一篇关于两者的好文章。 它注意到 mod_rewrite 规则在 mod_alias 规则之前执行。

mod_alias is basically a simpler version of mod_rewrite. It can't do some things that mod_rewrite can, such as manipulate the query string. If you're able to choose either of them, I don't see any reason that you'd want to use mod_alias.

Is there a specific reason you need to try to use both together?

Apache mod_rewrite & mod_alias tricks you should know seems to be a good article about the two. It notes at one point that mod_rewrite rules get executed before mod_alias ones.

指尖微凉心微凉 2024-07-26 05:06:53

正如接受的答案所说: mod_rewrite 可以做 mod_alias 不能做的事情。 然而,mod_alias 的主要好处是它更易于使用。

apache 文档说我们应该使用 mod_alias 来处理重定向等简单的事情,而 mod_rewrite 仅用于我们无法使用 mod_alias 等简单模块完成的事情。 查看文档:何时不使用 mod_rewrite

As the accepted answer says: mod_rewrite can do things which mod_alias can't. However the main benefit of mod_alias is that it is easier to use.

The apache docs say that we should use mod_alias for simple things like redirects and mod_rewrite only for things we cannot do with simpler modules like mod_alias. View the docs: When not to use mod_rewrite.

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