httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eduard B <>
Subject [users@httpd] Rewrite rules working properly in the htaccess but no in the virtualhost
Date Wed, 19 Oct 2011 08:02:49 GMT


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


  ServerAdmin hostmaster@server.tld

  DocumentRoot /home/


  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


rewrite debug in virtualhost: - - [19/Oct/2011:09:47:12 +0200] [][rid#7f12ae133640/initial]
(2) init rewrite engine with requested uri /robots.txt - - [19/Oct/2011:09:47:12 +0200] [][rid#7f12ae133640/initial]
(3) applying pattern '.*robots\.txt$' to uri '/robots.txt' - - [19/Oct/2011:09:47:12 +0200] [][rid#7f12ae133640/initial]
(2) rewrite '/robots.txt' -> '/robots-123456789.txt' - [19/Oct/2011:09:47:12 +0200] [][rid#7f12ae133640/initial]
(2) local path result: /robots-123456789.txt - - [19/Oct/2011:09:47:12 +0200] [][rid#7f12ae133640/initial]
(2) prefixed with document_root to /home/ - - [19/Oct/2011:09:47:12 +0200] [][rid#7f12ae133640/initial]
(1) go-ahead with /home/ [OK]

rewrite debug in .htaccess - - [19/Oct/2011:09:44:37 +0200] [][rid#7fcb16cfb530/initial]
(2) init rewrite engine with requested uri /robots.txt - [19/Oct/2011:09:44:37 +0200] [][rid#7fcb16cfb530/initial]
(1) pass through /robots.txt - - [19/Oct/2011:09:44:37 +0200] [][rid#7fcb16cfb530/initial]
(3) [perdir /home/] strip per-dir prefix: /home/
-> robots.txt - - [19/Oct/2011:09:44:37 +0200] [][rid#7fcb16cfb530/initial]
(3) [perdir /home/] applying pattern '.*robots\.txt$' to uri 'robots.txt' - - [19/Oct/2011:09:44:37 +0200] [][rid#7fcb16cfb530/initial]
(2) [perdir /home/] rewrite 'robots.txt' -> '/robots-123456789.txt' - - [19/Oct/2011:09:44:37 +0200] [][rid#7fcb16cfb530/initial]
(1) [perdir /home/] internal redirect with /robots-123456789.txt [INTERNAL
REDIRECT] - - [19/Oct/2011:09:44:37 +0200] [][rid#7fcb16d00ba0/initial/redir#1]
(2) init rewrite engine with requested uri /robots-123456789.txt - - [19/Oct/2011:09:44:37 +0200] [][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:
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 ?


View raw message