Mod_rewrite or mod_alias?

I have a server, in its httpd.conf there are already some directives "RedirectMatch constantly".

I am not very familiar with mod_alias, I only ever used mod_rewrite.

What is the fundamental difference? I do not see the flag "L" in mod_alias to stop the processing of rules.

Which one should be used for best practice redirects from one subdomain to another?

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

+23
redirect apache mod-rewrite mod-alias
Apr 30 '09 at 17:04
source share
2 answers

mod_alias is basically a simplified version of mod_rewrite. It cannot perform some of the actions that mod_rewrite can do, for example, manipulate a query string. If you can select any of them, I see no reason why you want to use mod_alias.

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

Apache mod_rewrite and the mod_alias that you should know seems like a good article about two. At one point, he notes that the mod_rewrite rules are executed before mod_alias.

+20
Apr 30 '09 at 17:20
source share

As the accepted answer says: mod_rewrite can do what mod_alias can mod_alias . However, the main advantage of mod_alias is that it is easier to use.

Apache docs say we should use mod_alias for simple things like redirects and mod_rewrite only for things we can't do with simpler modules like mod_alias . View documents: when not to use mod_rewrite .

0
Jul 14 '19 at 16:47
source share



All Articles