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

RE: rewrite and change document root on apache

> problem is that
> Document Root for each virtual host is on
>   /var/www/www.virtualhost1.com
> and I'm trying to forward http://www.virtualhost1.com/stats  to
>   /var/reports/www.virtualhost1.com
> so rewrite rule
> RewriteRule  ^/stats(.*)        /var/reports/%{SERVER_NAME}$1  [PT]
> really looks for
>   /var/www/www.virtualhost1.com/var/reports/www.virtualhost1.com
> not to
>     /var/reports/www.virtualhost1.com
> how to handle this:(  ????
> bests&thanks,
> jaume.

I believe that Apache dont permit you read files outside from

Humm... make a link from DocumentRoot to /var/reports, clean
and rewrite & alias lines and try ...

good luck!

Example of my rules for rewriting:


        ServerName www.pucela.org
        ServerAlias pucela.org *.pucela.org
#       ServerPath /pucela.org
        DocumentRoot /var/www/pucela.org
        ServerAdmin root@pucela.org
        CustomLog /var/log/apache/pucela.org-access_log common
        ErrorLog /var/log/apache/pucela.org-error_log
        ErrorDocument 404 /fallo.html
        RewriteEngine On
#       RewriteLog /var/log/apache/pucela.org-rewrite_log
#       RewriteLogLevel 9
        RewriteCond %{SERVER_NAME}      www\.(.*)\.pucela\.org [NC]
        RewriteRule ^/(.*)$             /%1/$1 [L]
        RewriteCond %{SERVER_NAME}      !^www [NC]
        RewriteCond %{SERVER_NAME}      (.*)\.pucela\.org [NC]
        RewriteRule ^/(.*)$             /%1/$1 [L]
Look: 2 rules, for 2 cases:


/ Asesora y Proveedora                   aprosi@aprosi.net
\ de Servicios de Internet, S.L.         aprosi@pucela.com

Reply to: