Hello,
Im 'having problems with the following rewrite rules. If I put this rewrite rules on the .htaccess in the document root of the virtual hosts, the rules work properly showing a robots.txt if the user don't has one. But when I try to put the rules in the virtualhost it looks like I can't redirect to the Alias <VirtualHost 192.168.0.01:80> ServerAdmin hostmaster@xxxxxxxxxx DocumentRoot /home/xxxxxx.com/web ServerName xxxxxx.com DirectoryIndex index.html index.php index.htm #This is the standard robots.txt ww what to have all the virtualhosts Alias /robots-123456789.txt /tmp/robots2.txt RewriteEngine On RewriteCond %{IS_SUBREQ} false #It redirect to our robots.txt (defined previously with the alias) if the user don't has a robots.txt i their home directory RewriteCond %{DOCUMENT_ROOT}/robots.txt !-f RewriteRule robots.txt$ /robots-123456789.txt </VirtualHost> rewrite debug in virtualhost: 192.168.0.01 - - [19/Oct/2011:09:47:12 +0200] [www.xxxxxx.org/sid#7f12ade87e00][rid#7f12ae133640/initial] (2) init rewrite engine with requested uri /robots.txt 192.168.0.01 - - [19/Oct/2011:09:47:12 +0200] [www.xxxxxx.org/sid#7f12ade87e00][rid#7f12ae133640/initial] (3) applying pattern '.*robots\.txt$' to uri '/robots.txt' 192.168.0.01 - - [19/Oct/2011:09:47:12 +0200] [www.xxxxxx.org/sid#7f12ade87e00][rid#7f12ae133640/initial] (2) rewrite '/robots.txt' -> '/robots-123456789.txt' 192.168.0.01- - [19/Oct/2011:09:47:12 +0200] [www.xxxxxx.org/sid#7f12ade87e00][rid#7f12ae133640/initial] (2) local path result: /robots-123456789.txt 192.168.0.01 - - [19/Oct/2011:09:47:12 +0200] [www.xxxxxx.org/sid#7f12ade87e00][rid#7f12ae133640/initial] (2) prefixed with document_root to /home/frikadas.org/web/robots-123456789.txt 192.168.0.01 - - [19/Oct/2011:09:47:12 +0200] [www.xxxxxx.org/sid#7f12ade87e00][rid#7f12ae133640/initial] (1) go-ahead with /home/frikadas.org/web/robots-123456789.txt [OK] rewrite debug in .htaccess 192.168.0.01 - - [19/Oct/2011:09:44:37 +0200] [www.xxxxxx.org/sid#7fcb16a4fe00][rid#7fcb16cfb530/initial] (2) init rewrite engine with requested uri /robots.txt 192.168.0.01- - [19/Oct/2011:09:44:37 +0200] [www.xxxxxx.org/sid#7fcb16a4fe00][rid#7fcb16cfb530/initial] (1) pass through /robots.txt 192.168.0.01 - - [19/Oct/2011:09:44:37 +0200] [www.xxxxxx.org/sid#7fcb16a4fe00][rid#7fcb16cfb530/initial] (3) [perdir /home/frikadas.org/web/] strip per-dir prefix: /home/frikadas.org/web/robots.txt -> robots.txt 192.168.0.01 - - [19/Oct/2011:09:44:37 +0200] [www.xxxxxx.org/sid#7fcb16a4fe00][rid#7fcb16cfb530/initial] (3) [perdir /home/frikadas.org/web/] applying pattern '.*robots\.txt$' to uri 'robots.txt' 192.168.0.01 - - [19/Oct/2011:09:44:37 +0200] [www.xxxxxx.org/sid#7fcb16a4fe00][rid#7fcb16cfb530/initial] (2) [perdir /home/frikadas.org/web/] rewrite 'robots.txt' -> '/robots-123456789.txt' 192.168.0.01 - - [19/Oct/2011:09:44:37 +0200] [www.xxxxxx.org/sid#7fcb16a4fe00][rid#7fcb16cfb530/initial] (1) [perdir /home/frikadas.org/web/] internal redirect with /robots-123456789.txt [INTERNAL REDIRECT] 192.168.0.01 - - [19/Oct/2011:09:44:37 +0200] [www.xxxxxx.org/sid#7fcb16a4fe00][rid#7fcb16d00ba0/initial/redir#1] (2) init rewrite engine with requested uri /robots-123456789.txt 192.168.0.01 - - [19/Oct/2011:09:44:37 +0200] [www.xxxxxx.org/sid#7fcb16a4fe00][rid#7fcb16d00ba0/initial/redir#1] (1) pass through /robots-123456789.txt It apears that in the .htacces file apache is able to redirect to the alias but in the virtualhost it apears that it can't redirect to it! I tested it in: Linux Server Version: Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze3 with Suhosin-Patch Server Built: Sep 29 2011 20:59:05 and in: FreeBSD 6.3-RELEASE-p3 apache-2.0.63_3 Server Built: Mar 2 2010 02:19:12 My qüestion is, what I have to do to get it working in the virtualhost ? Thanks! |