httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brunet Eric <er...@maniasys.com>
Subject [users@httpd] pb with rewrite and variables
Date Tue, 12 Nov 2002 11:46:37 GMT
hello,

I have some frustrations with mod_rewrite and it "voodoo" syntax :)
I just want to pass  %{HTTP_HOST} in the "condpattern" of RewriteCond, 
is it possible???
because after many tentatives, apache didn't expanse the variable.

I need this test for my situtation:
I have many virtual host with personal domains like this: 
<name>.sub-domain.domain.foo
the DocumentRoot of each user must be /MISC/%{HTTP_HOST}/
In order to make some parses of these web page _without_ creates one 
virtual host context by user, I wrote these rules:

<VirtualHost w.x.y.z>
DocumentRoot /MISC
</VirtualHost>

<Directory "/MISC">
RewriteEngine  on
RewriteBase /
###pages filters (others extension is not treated and server respond 
immediately)
##//case 1: file requested is a page!
RewriteCond %{REQUEST_FILENAME} ^/$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} ^$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} \.htm$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} \.html$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} \.php$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} \.php3$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} \.php4$ [NC]
RewriteRule !rewrite/(.*) /rewrite/webhosting_page.php?%{QUERY_STRING} [L]


#//case 2: file requested is not a page ! (=data: image, flash...)
#RewriteCond %{REQUEST_URI} !/\%\{HTTP_HOST\}.* [NC]  -> don't work!
RewriteRule (.+) /%{HTTP_HOST}$1 [L]
</Directory>

Notice:
I need to put rewrite rules in directory context for others reasons.

thanks to yours answers







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


Mime
View raw message