FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian ISP

 
 
LinkBack Thread Tools
 
Old 03-22-2010, 05:20 PM
Marc Aymerich
 
Default apache2, mod_rewrite and RedirectMatch

Hi!!*I have an apache2.15 with a lot of redirections using redirect and redirectmatch directives. Today I write some mod_rewrite rules (because I need some conditional redirections). I put this new rewrite directives after my old redirect and redirectmatch rules, just at the end of the virtualhost definition, because I expect that apache execute first my old definitions, and then my new rewrite rules. But apache execute the mod_rewrite rules in the first place!*


An example:
<VirtualHost *:80>ServerName myvirtualhost.com*[...]Redirect /lollipop http://lollipop.com

*[...]RewriteEngine onRewriteRule /lollipop http://example.org</VirtualHost>
** **myvirtualhost.com/lollipop is redirected to http://example.org !!*


There are any way to change this behavior?
Thanks a lot!Marc
 
Old 03-22-2010, 05:45 PM
Bertrand Yvain
 
Default apache2, mod_rewrite and RedirectMatch

On Mon, Mar 22, 2010 at 07:20:56PM +0100, Marc Aymerich wrote:
> I have an apache2.15 with a lot of redirections using redirect and
> redirectmatch directives. Today I write some mod_rewrite rules (because I
> need some conditional redirections). I put this new rewrite directives after
> my old redirect and redirectmatch rules, just at the end of the virtualhost
> definition, because I expect that apache execute first my old definitions,
> and then my new rewrite rules. But apache execute the mod_rewrite rules in
> the first place!
[...]
> There are any way to change this behavior?

No. mod_rewrite translates names at APR_HOOK_FIRST but mod_alias at
APR_HOOK_MIDDLE. So, whatever order your modules are loaded, you'll get
rewrite rules to be evaluated before any mod_alias translation.

--
Bertrand Yvain
http://www.IELO.net/
 
Old 03-22-2010, 06:23 PM
Marc Aymerich
 
Default apache2, mod_rewrite and RedirectMatch

On Mon, Mar 22, 2010 at 7:45 PM, Bertrand Yvain <pnl@ielo.net> wrote:


On Mon, Mar 22, 2010 at 07:20:56PM +0100, Marc Aymerich wrote:

> I have an apache2.15 with a lot of redirections using redirect and

> redirectmatch directives. Today I write some mod_rewrite rules (because I

> need some conditional redirections). I put this new rewrite directives after

> my old redirect and redirectmatch rules, just at the end of the virtualhost

> definition, because I expect that apache execute first my old definitions,

> and then my new rewrite rules. But apache execute the mod_rewrite rules in

> the first place!

[...]

> There are any way to change this behavior?



No. *mod_rewrite translates names at APR_HOOK_FIRST but mod_alias at

APR_HOOK_MIDDLE. *So, whatever order your modules are loaded, you'll get

rewrite rules to be evaluated before any mod_alias translation.
*Thank you*Bertrand ! Then, the solution will be to migrate all redirections to mod rewriteż
 
Old 03-22-2010, 06:30 PM
Bertrand Yvain
 
Default apache2, mod_rewrite and RedirectMatch

On Mon, Mar 22, 2010 at 08:23:08PM +0100, Marc Aymerich wrote:
> Thank you Bertrand ! Then, the solution will be to migrate all redirections
> to mod rewriteż

You're welcome.

This is probably the way to go. mod_rewrite is a very powerfull tool
and I can't see any feature in mod_alias that you can't emulate with
mod_rewrite.

One other way would be to place your rewrite rules in per directory
.htaccess but it might not be suitable in your case (and there is a
slight performance penality).

--
Bertrand Yvain
http://www.IELO.net/


--
To UNSUBSCRIBE, email to debian-isp-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20100322193005.GQ2726@nexus6.adm.ielo.net">http://lists.debian.org/20100322193005.GQ2726@nexus6.adm.ielo.net
 

Thread Tools




All times are GMT. The time now is 05:21 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org