You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Miller Thomas <Th...@ffm2.siemens.de> on 2002/05/23 16:17:25 UTC
Rewriting problem at root of virtual host
Hi,
the problem I try to solve is: rewrite all urls except a known list to come
from another host
i.e.
http://web1
http://web1/z1
http://web1/z2
should come from web1 but
http://web1/z3/... should be rewritten to www.web2.com/sub/z3/...
(no final list here).
(Like home directories but without the ~)
I created a virtual host with the rewrite directives shown below. Everything
seems to work fine with one exception:
a call to www.web1.com or www.web1.com/ returns with d:\index.html instead
of d:\apache\web1\index.html.
This might be related to the FAQ "Why don't some of my URLs get prefixed
with DocumentRoot when using mod_rewrite? " but this FAQ doesn`r contain a
solution how to do handle rules on the top level.
Thanks for your help.
Thomas
Here`s the http.conf excerpt
----------------------------------------------------------------------------
------------
<VirtualHost 127.0.0.1:80>
DocumentRoot "D:/apache/web1/"
ServerName web1
ProxyPassReverse /v/ http://web2/v/
RewriteEngine on
#the next three statements ar ethe problem ones
RewriteRule ^$ /index.html
RewriteRule ^/$ /index.html
RewriteRule ^/index\.html - [L]
#map z1 to z1/
RewriteRule ^/z1$ /z1/ [R]
#leave z1 unchanged
RewriteRule ^/z1/(.*) - [L]
#map z2 to z2/
RewriteRule ^/z2$ /z2/ [R]
#leave z2 unchanged
RewriteRule ^/z2/(.*) - [L]
#map web1/name to web1/name/
RewriteRule ^/([^/]*)$ /$1/ [R]
#map web1/* to web2/v/*
# RewriteRule ^/(.*) http://web2/v/$1 [P,L]
RewriteLog rewrite.log
RewriteLogLevel 9
</VirtualHost>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org