Forum Moderators: phranque

Message Too Old, No Replies

problem with mod_rewrite inside virtual host statements

mod_rewrite http https virtual host "redirect limit exceeded"

         

nluetic

9:10 pm on Nov 20, 2005 (gmt 0)

10+ Year Member



Hello,

as far as I understand, configuration options inside a virtual host statement shouldn't be influenced by one another.

However I have the following problem:

I have an old server being abandoned. The projects there are moved to a new one, one by one.

So I use mod_rewrite like this:
<VirtualHost 1.2.3.4:80>
...
RewriteEngine On
RewriteRule ^/(PROJ)(.*)$ [new.com...] [R,L]
</VirtualHost>

This works.

When I add a second directive for https for achieving the same behavior there, this seems to work as well. But in this case I get an error: "Redirect Limit exceeded" for all projects *not* matched by the rule.
I tried using RewriteCond limiting the rewrite to the relevant projects, but to no avail.

Any ideas?

jdMorgan

4:16 pm on Nov 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



nluetic,

Welcome to WebmasterWorld!

I really can't comment on code I can't see... Could you post the corresponding HTTPS section?

Jim

nluetic

6:10 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



Sorry for being unclear.

It's just the same thing with another port/redirection:

<VirtualHost 1.2.3.4:443>
...
RewriteEngine On
RewriteRule ^/(PROJ)(.*)$ [new.com...] [R,L]
</VirtualHost>

I have to add, that mod_alias is used too, for the projects, that stay on the server, i.e.:
Alias /PROJ2STAY "/home/www/PROJ2STAY/html/"
From there it goes via index.php to another index.php in the main application directory, and from there to login.php.

When I take a look into the Rewrite log I can see, that the error occurs with "login.php". This is checked by the mod_rewrite-Rule over and over again, although the projectstring doesn't match the rule, what is shown correctly:

#*$!.xxx.xxx.xxx - - [21/Nov/2005:18:51:21 +0100] [www.xxx.xxx/sid#8187ca8][rid#819aa50/initial] (2) init rewrite engine with requested uri /PROJ2STAY
xxx.xxx.xxx.xxx - - [21/Nov/2005:18:51:21 +0100] [xxx.xxx.xxx/sid#8187ca8][rid#819aa50/initial] (3) applying pattern '^/(PROJ2GO-1¦PROJ2GO-2)(.*)$' to uri '/PROJ2STAY'
xxx.xxx.xxx.xxx - - [21/Nov/2005:18:51:21 +0100] [www.xxx.xxx/sid#8187ca8][rid#819aa50/initial] (1) pass through /PROJ2STAY

This is repeated for "/PROJ2STAY/", "PROJ2STAY/index.html" etc. until the loop with:

xxx.xxx.xxx.xxx - - [21/Nov/2005:18:51:21 +0100] [www.xxx.xxx/sid#8191a48][rid#819aa50/initial] (3) applying pattern '^/(PROJ2GO-1¦PROJ2GO-2)(.*)$' to uri '/APPDIR/login.php3'
xxx.xxx.xxx.xxx - - [21/Nov/2005:18:51:21 +0100] [www.xxx.xxx/sid#8191a48][rid#819aa50/initial] (1) pass through /APPDIR/login.php3

So I suppose something else is causing this. As all the index-stuff is done, it shouldn't be an issue of mod_dir. But what else?

jdMorgan

6:17 pm on Nov 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What happens if you retain the port number?

RewriteRule ^/(PROJ.*)$ https://www.new.com[b]:443[/b]/$1 [R,L]

Jim

nluetic

6:48 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



Same story.

I also changed the options for the rewrite-rule into:
[R=301,L].

When looking at access_log and it shows me a 301 for all PROJ2GO, but a 302 for PROJ2STAY!?

nluetic

7:15 pm on Nov 21, 2005 (gmt 0)

10+ Year Member



My problem has something to do, with a redirect done inside the php-program.

Otherwise solved.

Thanks for Your replies.