You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Porter, Mark" <Ma...@LibertyMutual.com> on 2003/11/06 03:42:42 UTC

[users@httpd] RewriteRule Strangeness

Hi Everyone,

Apache 2.0.47 on Solaris 9.

I have a rewrite rule in place thus:

RewriteCond %{HTTP_HOST} ^www.site.com
RewriteCond %{REQUEST_URI} /auto
RewriteRule /.*
http://www.othersite.com/omapps/ContentServer?cid=1056650100187&pagename
=PMInternet%2FPage%2FPMSecondaryRed&c=Page [R]

Hitting http://www.site.com/auto, I'm redirected to the long path in the
rule... almost. The redirect is stripping out the %2 characters, so I
end up here:

http://www.othersite.com/omapps/ContentServer?cid=1056650100187&pagename
=PMInternetFPageFPMSecondaryRed&c=Page

I'm at the mercy of the content people, who develop on Windows, and
refuse to change the path.

The server itself is a catch all, that has 80 some-odd hosts in DNS
pointed to it, all with one IP address. It's there to send each host to
a specific path on www.othersite.com. In some cases, one host will have
multiple path requirements - like www.site.com/auto, which has to go
somewhere special, different from where www.site.com ends up.

The odd thing is that if I use a redirect, the % characters are Ok. 

Redirect /auto
http://www.othersite.com/omapps/ContentServer?cid=1056650100187&pagename
=PMInternet%2FPage%2FPMSecondaryRed&c=Page works fine.

I was wondering if anyone else had run into this before.

One solution might be to set up a name-based vhost for each of the 80
hosts, and use the redirect statement in there, versus using RewriteCond
%{HTTP_HOST}. However, I would love to get this working in its current
form, should there be an easy solution.

Any help is appreciated!

Mark


---------------------------------------------------------------------
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] RewriteRule Strangeness

Posted by Joshua Slive <jo...@slive.ca>.
On Wed, 5 Nov 2003, Porter, Mark wrote:
> Hitting http://www.site.com/auto, I'm redirected to the long path in the
> rule... almost. The redirect is stripping out the %2 characters, so I
> end up here:

Have you tried the "NE" flag to RewriteRule?  (See the mod_rewrite docs.)

Joshua.

---------------------------------------------------------------------
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