httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugh Williams <>
Subject mod_rewrite not substituting properly
Date Wed, 16 Jan 2002 02:03:35 GMT

My Apache migration has proven troublesome.  Went from
 HP-UX 11.00 running Apache 1.3.14
 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: - - [15/Jan/2002:17:29:12 -0800] [][rid#400ef738/initial]
(2) init rewrite engine with requested uri /cgi-bin/public/atm/ - - [15/Jan/2002:17:29:12 -0800] [][rid#400ef738/initial]
(3) applying pattern '^/cgi-bin/public/atm/(.*)' to uri '/cgi-bin/public/atm/' - - [15/Jan/2002:17:29:12 -0800] [][rid#400ef738/initial]
(2) rewrite /cgi-bin/public/atm/ -> /cgi-bin/org/atm//cgi-bin/public/atm/ - - [15/Jan/2002:17:29:12 -0800] [][rid#400ef738/initial]
(2) forcing '/cgi-bin/org/atm//cgi-bin/public/atm/' 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

 ^/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/ /cgi-bin/org/atm/ [R]

But having to have a rewrite line for each file is not pretty :-(




 Hugh Williams			"More men are killed by overwork than the	 importance of the world justifies."
 Agilent Technologies		 	 	- Rudyard Kipling
 Santa Rosa 2LS-R  			      "The Phantom Rickshaw", 1888

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message