[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Apache mod_rewrite



On Wed, Aug 30, 2000 at 10:18:14PM +0000, Jaume Teixi wrote:
> I need to do the following in order to access stats for each based
> virtual host
> 
> when typing url   www.virtualhost1.com/stats  or
> www.virtualhost99.com/stats
> server page located under  /var/reports/virtualhost1   or
> /var/reports/virtualhost99
> 
> I've tryed on my httpd.conf:
> 
> RewriteEngine   on
> RewriteCond     %{HTTP_HOST}    ^www\.[^.]+$
> RewriteRule     ^(.+)           %{HTTP_HOST}$1  [C]
> RewriteRule     ^www\.([^.]+)(.*)/stats    /var/reports/$1
> 
> Apache produces a 404
> 
> any points to fix this ?

mod_rewrite rewrites the url, you're confusing it with the path to the
files.

try setting up a global Alias like so:

	Alias /reports/ /var/reports/

then use mod_rewrite to rewrite the URL "www.virtual.com/stats" to
"www.virtual.com/reports/virtual.com/".  the rewrite above should work, but
the final line should be:

RewriteRule     ^www\.([^.]+)(.*)/stats    /reports/$1


another way of doing it is to just have a symlink in their document root.

craig

--
craig sanders



Reply to: