[Linux-disciples] URL rewriting weirdness

Adam Rosi-Kessel adam at rosi-kessel.org
Tue Feb 1 13:26:48 EST 2005


(1) You can't put http:// in a RewriteRule if you don't want
redirection; otherwise it will redirect to the new location because it
looks like an external URL (obviously mod_rewrite cannot rewrite to URLs
not stored on the server). There is supposed to be a feature that
detects when the host specified is actually the local host, but
apparently it's not doing that for you, maybe because you are not using
the canonical hostname for your server.

(2) To do this with Zope, you need the Virtual Host Monster installed in
your root Zope folder.

(3) You need to use the [P] flag with RewriteRule to pass the URL to
mod_proxy, e.g.:

RewriteRule ^zope_site/*(.*) \
http://hostname:9673/VirtualHostBase/http/hostname:80/zope_site/$1 [P]

Stephen R Laniel wrote:
> I'm trying to use mod_rewrite to get requests of the form
>
> hostname/path
>
> to map to
>
> hostname:9673/aMuchLongerPath
>
> I used
>
> RewriteRule hostname/path http://hostname:9673/aMuchLongerPath
>
> and got a bit more than I wanted: the redirection works, but
> the URL in the location bar actually gets rewritten to the
> longer, uglier URL. I suspect that's because I included the
> 'http://' in the substitution part, but I couldn't think of
> any way around that, if I'm also going to include the
> port-9673 part. Normally I thought the location bar only got
> rewritten if you used the [R] flag.
>
> I'm sure this is an easy question. Any takers?
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20050201/d4315707/signature.pgp


More information about the Linux-disciples mailing list