You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Hugh Williams <hu...@soco.agilent.com> on 2002/01/16 03:03:35 UTC
mod_rewrite not substituting properly
Hello;
My Apache migration has proven troublesome. Went from
HP-UX 11.00 running Apache 1.3.14
to
HP-UX 11.11 running Apache 1.3.22
and now mod_rewrite appears to behave differently. The problem I have
been solving on both old and new platforms is
old web site had path /cgi-bin/public/...
new web site has path /cgi-bin/org/...
all else in downstream path(s) identical
So, I'm trying to rewrite that URI. No virtual hosts; inside httpd.conf:
DocumentRoot /opt/apache/htdocs
RewriteEngine on
RewriteLog /opt/apache/logs/rewrite_log
RewriteLogLevel 4
RewriteRule ^/cgi-bin/public/atm/(.*) /cgi-bin/org/atm/$1 [PT]
rewrite_log says:
141.121.49.4 - - [15/Jan/2002:17:29:12 -0800] [jade.soco.agilent.com/sid#40025000][rid#400ef738/initial] (2) init rewrite engine with requested uri /cgi-bin/public/atm/atm_issues.pl
141.121.49.4 - - [15/Jan/2002:17:29:12 -0800] [jade.soco.agilent.com/sid#40025000][rid#400ef738/initial] (3) applying pattern '^/cgi-bin/public/atm/(.*)' to uri '/cgi-bin/public/atm/atm_issues.pl'
141.121.49.4 - - [15/Jan/2002:17:29:12 -0800] [jade.soco.agilent.com/sid#40025000][rid#400ef738/initial] (2) rewrite /cgi-bin/public/atm/atm_issues.pl -> /cgi-bin/org/atm//cgi-bin/public/atm/atm_issues.pl
141.121.49.4 - - [15/Jan/2002:17:29:12 -0800] [jade.soco.agilent.com/sid#40025000][rid#400ef738/initial] (2) forcing '/cgi-bin/org/atm//cgi-bin/public/atm/atm_issues.pl' to get passed through to next API URI-to-filename handler
Can anyone shed light on why the rewrite is apparently appending the
entire search pattern, and not just the captured back-reference piece of
the search pattern? I've tried:
flags PT, R, and L in various configurations
^/cgi-bin/public/atm(.*) /cgi-bin/org/atm$1
just like the documented example in
http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteRule
^/cgi-bin/public/(.*) /cgi-bin/org/$1
All have similar results. This worked on the older OS/Apache
combination, and I can still get it to work on other older servers. I
can also get rewrites to work in the new environment if I 'hard-code'
the rewrite; this works just great:
RewriteRule /cgi-bin/public/atm/atm_issues.pl /cgi-bin/org/atm/atm_issues.pl [R]
But having to have a rewrite line for each file is not pretty :-(
Thanks,
hugh
--
Hugh Williams "More men are killed by overwork than the
hugh_williams@agilent.com importance of the world justifies."
Agilent Technologies - Rudyard Kipling
Santa Rosa 2LS-R "The Phantom Rickshaw", 1888
(707)-577-4941
---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
Re: mod_rewrite not substituting properly
Posted by Martin Haase-Thomas <mh...@meome-ag.de>.
Hi,
I'm not sure whether I'll really hit your problem, but maybe, I had
similar problems with the two versions of apache you mentioned.
What I found out is that in 1.3.22 at least one Apache global has
changed its content, namely %{REQUEST_FILENAME}.
e.g.:
Request: GET http://ww.foo.com/baz/blah.html
%{REQUEST_FILENAME} in 1.3.14: 'blah.html' - in 1.3.22 '/baz/blah.html'.
Furthermore mod_rewrite hav real problems with unary operators, as '-s'
or '-f'. This seems being a bug to me, as I've been quarreling two days
with that handful of chars.
Hope this is helpful
Martin
Hugh Williams wrote:
>Hello;
>
>My Apache migration has proven troublesome. Went from
> HP-UX 11.00 running Apache 1.3.14
>to
> HP-UX 11.11 running Apache 1.3.22
>
>and now mod_rewrite appears to behave differently. The problem I have
>been solving on both old and new platforms is
>
> old web site had path /cgi-bin/public/...
> new web site has path /cgi-bin/org/...
>
>all else in downstream path(s) identical
>
>So, I'm trying to rewrite that URI. No virtual hosts; inside httpd.conf:
>
>DocumentRoot /opt/apache/htdocs
> RewriteEngine on
> RewriteLog /opt/apache/logs/rewrite_log
> RewriteLogLevel 4
> RewriteRule ^/cgi-bin/public/atm/(.*) /cgi-bin/org/atm/$1 [PT]
>
>
>rewrite_log says:
>
>141.121.49.4 - - [15/Jan/2002:17:29:12 -0800] [jade.soco.agilent.com/sid#40025000][rid#400ef738/initial] (2) init rewrite engine with requested uri /cgi-bin/public/atm/atm_issues.pl
>141.121.49.4 - - [15/Jan/2002:17:29:12 -0800] [jade.soco.agilent.com/sid#40025000][rid#400ef738/initial] (3) applying pattern '^/cgi-bin/public/atm/(.*)' to uri '/cgi-bin/public/atm/atm_issues.pl'
>141.121.49.4 - - [15/Jan/2002:17:29:12 -0800] [jade.soco.agilent.com/sid#40025000][rid#400ef738/initial] (2) rewrite /cgi-bin/public/atm/atm_issues.pl -> /cgi-bin/org/atm//cgi-bin/public/atm/atm_issues.pl
>141.121.49.4 - - [15/Jan/2002:17:29:12 -0800] [jade.soco.agilent.com/sid#40025000][rid#400ef738/initial] (2) forcing '/cgi-bin/org/atm//cgi-bin/public/atm/atm_issues.pl' to get passed through to next API URI-to-filename handler
>
>
>Can anyone shed light on why the rewrite is apparently appending the
>entire search pattern, and not just the captured back-reference piece of
>the search pattern? I've tried:
>
> flags PT, R, and L in various configurations
>
> ^/cgi-bin/public/atm(.*) /cgi-bin/org/atm$1
> just like the documented example in
> http://httpd.apache.org/docs/mod/mod_rewrite.html#RewriteRule
>
> ^/cgi-bin/public/(.*) /cgi-bin/org/$1
>
>All have similar results. This worked on the older OS/Apache
>combination, and I can still get it to work on other older servers. I
>can also get rewrites to work in the new environment if I 'hard-code'
>the rewrite; this works just great:
>
>RewriteRule /cgi-bin/public/atm/atm_issues.pl /cgi-bin/org/atm/atm_issues.pl [R]
>
>But having to have a rewrite line for each file is not pretty :-(
>
>Thanks,
>
>hugh
>
---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org