You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Huesser Peter <pe...@psi.ch> on 2007/01/08 15:12:19 UTC

[users@httpd] Rewrite does not work

Hello

 

I have a problem with a rewrite. In my httpd.conf I use the following
lines:

 

ScriptAlias /test/ /var/test/cgi-bin/

Alias /pipermail/ /var/test/archives/public/

<Directory /var/test/archives>

        Options +FollowSymlinks

</Directory>

 

RewriteEngine On

RewriteCond %{SERVER_PORT}       ^80$

RewriteRule ^(.+)$ https://server.domain.ch$1 [R]

 

RewriteCond %{REMOTE_HOST} \.domain\.ch$

RewriteRule ^/testtinfo/fea http://another.url.ch/

 

The first RewriteCond maps all request on port 80 to the port 443 an
works fine. But the second RewriteCond has no effect Any idea?

 

Thanks' for any help

 

Pedro

 


RE: [users@httpd] Rewrite does not work

Posted by Huesser Peter <pe...@psi.ch>.
> 
> Is there a .htaccess file somehwere in your mailmain install? If so,
> have a look in there...
> 

No.

Pedro


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Krist van Besien <kr...@gmail.com>.
On 1/11/07, Peter Huesser <pe...@psi.ch> wrote:
>
> > What might also  be an issue here is that reverse DNS doesn't work
> > properly.
> >
> > However, what you are trying to achieve might be better done
> > differently. See another post in this forum. You ought to set up two
> > virtual hosts, one on port 80 and one on port 443. Have a redirect to
> > the https host in the http host, and have your rewrite in the https
> > host config.
> >
> Hello Krist
>
> The tip with the two virtual hosts did not work either. In the meantime
> I guess it
> is a mailman problem (see my other postings). I have an etnry in the
> rewrite.log
> file which shows me that the RewriteCond I have is really used. But the used
> RewriteRule is not what I wrote in the httpd.conf file! At the moment I
> have the
> following entries in httpd.conf:
>
>   RewriteEngine On
>   RewriteCond %{REMOTE_HOST} \.domain\.ch$
>   RewriteRule ^/testtinfo/fea http://another.url.ch/
>
> The produced entries in rewrite.log are:
>
> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (2) init rewrite engine
> with requested uri /testtinfo/fea
> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (3) applying pattern
> '^/testtinfo/fea' to uri '/testtinfo/fea'
> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (1) pass through
> /testtinfo/fea
> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
> [server.psi.ch/sid#80c1cc8][rid#808be78/subreq] (2) init rewrite engine
> with requested uri /fea
> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
> [server.psi.ch/sid#80c1cc8][rid#808be78/subreq] (3) applying pattern
> '^/mailman/listinfo/fea' to uri '/fea'
> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
> [server.psi.ch/sid#80c1cc8][rid#808be78/subreq] (1) pass through /fea
>
> which does not make any sense to me.

Is there a .htaccess file somehwere in your mailmain install? If so,
have a look in there...

Krist

-- 
krist.vanbesien@gmail.com
Bremgarten b. Bern, Switzerland
--
"...what you don't realize is that in the future Google WILL reach
sentience, will [have had] invent[ed] a time machine, and will [have
had] travel[ed] back in time to prevent Bill Gates... only to become
Bill Gates by accident because of a search engine optimization
miscalculation." (Comment on the Dilbert Blog)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Rewrite does not work

Posted by Huesser Peter <pe...@psi.ch>.
> 
> Apache does not do reverse lookups on client host IPs by default.
> See:
> http://httpd.apache.org/docs/2.0/mod/core.html#hostnamelookups
> 

Thanks'

  Pedro


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Krist van Besien <kr...@gmail.com>.
On 1/12/07, Peter Huesser <pe...@psi.ch> wrote:
> >
> > Another thought: Did you set the directive RewritelogLevel at least to
> > 4? (6 = highest used). Below loglevel 4, the processing of conditions
> > is not being logged.
> >
> Wow, that was the break-through.Had a loglevel of 3 until now. Here the
> new log entries:
>
> 129.129.194.181 - - [12/Jan/2007:10:06:29 +0100]
> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (2) init rewrite engine
> with requested uri /usage/
> 129.129.194.181 - - [12/Jan/2007:10:06:29 +0100]
> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (3) applying pattern
> '^/usage' to uri '/usage/'
> 129.129.194.181 - - [12/Jan/2007:10:06:29 +0100]
> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (4) RewriteCond:
> input='129.129.194.181' pattern='\.psi\.ch$' => not-matched
>
> I changed the RewriteCond to
>
> RewriteCond %{REMOTE_HOST} ^129\.129\.
>
> No it works!! Krist van Besien wrote a few mails ago "What might also be
> an issue here is that reverse DNS doesn't work properly". So it seems
> that he was right. I checked it on the machine (server.psi.ch) using
> "nslookup IP" and I got the correct answer. Therefor I thought this
> could not be the problem. But apache may to behave different.

Apache does not do reverse lookups on client host IPs by default.
See:
http://httpd.apache.org/docs/2.0/mod/core.html#hostnamelookups

Krist

-- 
krist.vanbesien@gmail.com
Bremgarten b. Bern, Switzerland
--
"...what you don't realize is that in the future Google WILL reach
sentience, will [have had] invent[ed] a time machine, and will [have
had] travel[ed] back in time to prevent Bill Gates... only to become
Bill Gates by accident because of a search engine optimization
miscalculation." (Comment on the Dilbert Blog)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Peter Huesser <pe...@psi.ch>.
>
> Another thought: Did you set the directive RewritelogLevel at least to
> 4? (6 = highest used). Below loglevel 4, the processing of conditions
> is not being logged.
>
Wow, that was the break-through.Had a loglevel of 3 until now. Here the
new log entries:

129.129.194.181 - - [12/Jan/2007:10:06:29 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (2) init rewrite engine
with requested uri /usage/
129.129.194.181 - - [12/Jan/2007:10:06:29 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (3) applying pattern
'^/usage' to uri '/usage/'
129.129.194.181 - - [12/Jan/2007:10:06:29 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (4) RewriteCond:
input='129.129.194.181' pattern='\.psi\.ch$' => not-matched

I changed the RewriteCond to

RewriteCond %{REMOTE_HOST} ^129\.129\.

No it works!! Krist van Besien wrote a few mails ago "What might also be
an issue here is that reverse DNS doesn't work properly". So it seems
that he was right. I checked it on the machine (server.psi.ch) using
"nslookup IP" and I got the correct answer. Therefor I thought this
could not be the problem. But apache may to behave different.

Anyway, thanks' a lot to all.

Pedro





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Bob <bo...@googlemail.com>.
Peter Huesser wrote:
> Bob wrote:
> 
>>> following entries in httpd.conf:
>>>
>>>   RewriteEngine On
>>>   RewriteCond %{REMOTE_HOST} \.domain\.ch$
>>>   RewriteRule ^/testtinfo/fea http://another.url.ch/
>>>
>>> The produced entries in rewrite.log are:
>>>
>>> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
>>> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (2) init rewrite engine
>>> with requested uri /testtinfo/fea
>>> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
>>> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (3) applying pattern
>>> '^/testtinfo/fea' to uri '/testtinfo/fea'
>>
>> This regEx should match /testtinfo/fea... Are other rules (if you call
>> /foo and have ^/foo as regEx) wirking fine?
>>
> No. I created a different rule
> 
>   RewriteEngine On
>   RewriteCond %{REMOTE_HOST} \.psi\.ch$
>   RewriteRule ^/usage http://another.url.ch/
> 
> and get the following in rewrite.log

Another thought: Did you set the directive RewritelogLevel at least to 
4? (6 = highest used). Below loglevel 4, the processing of conditions is 
not being logged.

-- 
Bob

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Peter Huesser <pe...@psi.ch>.
Bob wrote:

>> following entries in httpd.conf:
>>
>>   RewriteEngine On
>>   RewriteCond %{REMOTE_HOST} \.domain\.ch$
>>   RewriteRule ^/testtinfo/fea http://another.url.ch/
>>
>> The produced entries in rewrite.log are:
>>
>> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
>> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (2) init rewrite engine
>> with requested uri /testtinfo/fea
>> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
>> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (3) applying pattern
>> '^/testtinfo/fea' to uri '/testtinfo/fea'
>
>
> This regEx should match /testtinfo/fea... Are other rules (if you call
> /foo and have ^/foo as regEx) wirking fine?
>
No. I created a different rule

  RewriteEngine On
  RewriteCond %{REMOTE_HOST} \.psi\.ch$
  RewriteRule ^/usage http://another.url.ch/

and get the following in rewrite.log

129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (2) init rewrite engine
with requested uri /usage/
129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (3) applying pattern
'^/usage' to uri '/usage/'
129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (1) pass through /usage/
129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.psi.ch/sid#80c1cc8][rid#808be78/subreq] (2) init rewrite engine
with requested uri /usage/index.html
129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.psi.ch/sid#80c1cc8][rid#808be78/subreq] (3) applying pattern
'^/usage' to uri'/usage/index.html'
129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.wpsi.ch/sid#80c1cc8][rid#808be78/subreq] (1) pass through
/usage/index.html
129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.psi.ch/sid#80c1cc8][rid#80c4bf8/initial/redir#1] (2) init
rewrite engine withrequested uri /usage/index.html
129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.psi.ch/sid#80c1cc8][rid#80c4bf8/initial/redir#1] (3) applying
pattern '^/usage' to uri '/usage/index.html'
129.129.194.181 - - [11/Jan/2007:11:18:59 +0100]
[server.psi.ch/sid#80c1cc8][rid#80c4bf8/initial/redir#1] (1) pass
through /usage/index.html


????

Pedro



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Bob <bo...@googlemail.com>.
Peter Huesser wrote:
> following entries in httpd.conf:
> 
>   RewriteEngine On
>   RewriteCond %{REMOTE_HOST} \.domain\.ch$
>   RewriteRule ^/testtinfo/fea http://another.url.ch/
> 
> The produced entries in rewrite.log are:
> 
> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (2) init rewrite engine
> with requested uri /testtinfo/fea
> 129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
> [server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (3) applying pattern
> '^/testtinfo/fea' to uri '/testtinfo/fea'

This regEx should match /testtinfo/fea... Are other rules (if you call 
/foo and have ^/foo as regEx) wirking fine?

-- 
Bob

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Peter Huesser <pe...@psi.ch>.
> What might also  be an issue here is that reverse DNS doesn't work
> properly.
>
> However, what you are trying to achieve might be better done
> differently. See another post in this forum. You ought to set up two
> virtual hosts, one on port 80 and one on port 443. Have a redirect to
> the https host in the http host, and have your rewrite in the https
> host config.
>
Hello Krist

The tip with the two virtual hosts did not work either. In the meantime
I guess it
is a mailman problem (see my other postings). I have an etnry in the
rewrite.log
file which shows me that the RewriteCond I have is really used. But the used
RewriteRule is not what I wrote in the httpd.conf file! At the moment I
have the
following entries in httpd.conf:

  RewriteEngine On
  RewriteCond %{REMOTE_HOST} \.domain\.ch$
  RewriteRule ^/testtinfo/fea http://another.url.ch/

The produced entries in rewrite.log are:

129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (2) init rewrite engine
with requested uri /testtinfo/fea
129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (3) applying pattern
'^/testtinfo/fea' to uri '/testtinfo/fea'
129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
[server.psi.ch/sid#80c1cc8][rid#8140eb8/initial] (1) pass through
/testtinfo/fea
129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
[server.psi.ch/sid#80c1cc8][rid#808be78/subreq] (2) init rewrite engine
with requested uri /fea
129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
[server.psi.ch/sid#80c1cc8][rid#808be78/subreq] (3) applying pattern
'^/mailman/listinfo/fea' to uri '/fea'
129.129.194.181 - - [11/Jan/2007:09:40:24 +0100]
[server.psi.ch/sid#80c1cc8][rid#808be78/subreq] (1) pass through /fea

which does not make any sense to me.

Pedro





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Krist van Besien <kr...@gmail.com>.
On 1/9/07, Bob <bo...@googlemail.com> wrote:
> Huesser Peter wrote:
> > My interpretation of "RewriteCond
> > %{REMOTE_HOST} \.domain\.ch$" is the following: If the client that makes
> > the https request is within the "domain.ch" than apply the following
> > RewriteRule.
>
> Yes, this will cause a reverse DNS lookup of remote_addr. But anyway, I
> think your order is incorrect. If your request comes through port 80,
> the 2nd rule won't have any effect, because your first rule matched already.



What might also  be an issue here is that reverse DNS doesn't work properly.

However, what you are trying to achieve might be better done
differently. See another post in this forum. You ought to set up two
virtual hosts, one on port 80 and one on port 443. Have a redirect to
the https host in the http host, and have your rewrite in the https
host config.

Krist



-- 
krist.vanbesien@gmail.com
Bremgarten b. Bern, Switzerland
--
"...what you don't realize is that in the future Google WILL reach
sentience, will [have had] invent[ed] a time machine, and will [have
had] travel[ed] back in time to prevent Bill Gates... only to become
Bill Gates by accident because of a search engine optimization
miscalculation." (Comment on the Dilbert Blog)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Rewrite does not work

Posted by Huesser Peter <pe...@psi.ch>.
> 
> Usually not in server context, mod_rewrite acts before the mapping to
> filesystem occurs. You said that the rewrite log is completely empty,
> when you request /testtinfo/fea? That would mean the rules are not
seen
> at all, e.g. a <virtualhost> matched and the rules are defined in the
> main server config section.
> 

You are right. I put the RewriteCond into the <VirtualHost
_default_:443> section and now I get some entries in the rewrite.log
file. But it still does not work! I commented the RewriteCond and
RewriteRule lines out and still had some entries in the rewrite.log!!! I
am using mailman and all the (python) scripts are in "/testtinfo" (the
ScriptAlias line from a previous posting). Is it possible that this
python scripts make some internal rewrites which overwrite mine?

Pedro


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Bob <bo...@googlemail.com>.
Huesser Peter wrote:
>> Yes, this will cause a reverse DNS lookup of remote_addr. But anyway,
> I
>> think your order is incorrect. If your request comes through port 80,
>> the 2nd rule won't have any effect, because your first rule matched
>> already.
>>
>> RewriteEngine On
>> RewriteCond %{REMOTE_HOST} \.domain\.ch$
>> RewriteRule ^/testtinfo/fea http://another.url.ch/ [R,L]
>> RewriteCond %{SERVER_PORT} =80
>> RewriteRule ^(.+)$ https://server.domain.ch$1 [R,L]
>>
> 
> Hello Bob
> 
> I changed the order of the RewriteCond as you suggested but
> unfortunately it did not have any effect. Maybe I should also mention
> that /testtinfo is a ScriptAlias:
> 
> ScriptAlias /testtinfo /var/testtinfo/cgi-bin
> 
> Could this cause the problem?

Usually not in server context, mod_rewrite acts before the mapping to 
filesystem occurs. You said that the rewrite log is completely empty, 
when you request /testtinfo/fea? That would mean the rules are not seen 
at all, e.g. a <virtualhost> matched and the rules are defined in the 
main server config section.

-- 
Bob

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Rewrite does not work

Posted by Huesser Peter <pe...@psi.ch>.
> 
> Yes, this will cause a reverse DNS lookup of remote_addr. But anyway,
I
> think your order is incorrect. If your request comes through port 80,
> the 2nd rule won't have any effect, because your first rule matched
> already.
> 
> RewriteEngine On
> RewriteCond %{REMOTE_HOST} \.domain\.ch$
> RewriteRule ^/testtinfo/fea http://another.url.ch/ [R,L]
> RewriteCond %{SERVER_PORT} =80
> RewriteRule ^(.+)$ https://server.domain.ch$1 [R,L]
> 

Hello Bob

I changed the order of the RewriteCond as you suggested but
unfortunately it did not have any effect. Maybe I should also mention
that /testtinfo is a ScriptAlias:

ScriptAlias /testtinfo /var/testtinfo/cgi-bin

Could this cause the problem?

Pedro



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Bob <bo...@googlemail.com>.
Huesser Peter wrote:
> My interpretation of "RewriteCond
> %{REMOTE_HOST} \.domain\.ch$" is the following: If the client that makes
> the https request is within the "domain.ch" than apply the following
> RewriteRule.

Yes, this will cause a reverse DNS lookup of remote_addr. But anyway, I 
think your order is incorrect. If your request comes through port 80, 
the 2nd rule won't have any effect, because your first rule matched already.

RewriteEngine On
RewriteCond %{REMOTE_HOST} \.domain\.ch$
RewriteRule ^/testtinfo/fea http://another.url.ch/ [R,L]
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.+)$ https://server.domain.ch$1 [R,L]

-- 
Bob

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: [users@httpd] Rewrite does not work

Posted by Huesser Peter <pe...@psi.ch>.
> 
> What are you seeing in your rewrite log? (If you don't have a rewrite
> log, switch it on now, and set debugging to a sufficiently high
> level).
> 
Thanks for your answer. I turned it on and see nothing in the
rewrite.log file for the second RewriteCond (the first works fine and
produces several entries)!!! My interpretation of "RewriteCond
%{REMOTE_HOST} \.domain\.ch$" is the following: If the client that makes
the https request is within the "domain.ch" than apply the following
RewriteRule. Am I right?

Pedro


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite does not work

Posted by Krist van Besien <kr...@gmail.com>.
On 1/8/07, Huesser Peter <pe...@psi.ch> wrote:

> I have a problem with a rewrite. In my httpd.conf I use the following lines:
>
>
>
> ScriptAlias /test/ /var/test/cgi-bin/
>
> Alias /pipermail/ /var/test/archives/public/
>
> <Directory /var/test/archives>
>
>         Options +FollowSymlinks
>
> </Directory>
>
>
>
> RewriteEngine On
>
> RewriteCond %{SERVER_PORT}       ^80$
>
> RewriteRule ^(.+)$ https://server.domain.ch$1 [R]
>
>
>
> RewriteCond %{REMOTE_HOST} \.domain\.ch$
>
> RewriteRule ^/testtinfo/fea http://another.url.ch/
>
>
>
> The first RewriteCond maps all request on port 80 to the port 443 an works
> fine. But the second RewriteCond has no effect Any idea?

What are you seeing in your rewrite log? (If you don't have a rewrite
log, switch it on now, and set debugging to a sufficiently high
level).

Krist

-- 
krist.vanbesien@gmail.com
Bremgarten b. Bern, Switzerland
--
"...what you don't realize is that in the future Google WILL reach
sentience, will [have had] invent[ed] a time machine, and will [have
had] travel[ed] back in time to prevent Bill Gates... only to become
Bill Gates by accident because of a search engine optimization
miscalculation." (Comment on the Dilbert Blog)

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org