RewriteRule collision

in our 2 recent post about SuSE 9.3 and Plesk 8, we explained how to install AWstats and how to fix the favicon.ico and robots.txt log-spamming. unfortunately our 2 posts collided and prevented AWstats from working. we had to adjust the RewriteRule a little bit.

#place this file in /etc/apache2/conf.d and restart
#apache. gets rid of the annoying 404 entries in the
#error_log if favicon.ico or robots.txt are not present
<DirectoryMatch /srv/www/vhosts/([^/]*)/https?docs>
        RewriteEngine On
        RewriteBase /
        RewriteCond %{REQUEST_URI} ^/(favicon\.ico|robots\.txt)
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ /error/HTTP_NOT_FOUND.html.var [L]
</DirectoryMatch>

new version:

#place this file in /etc/apache2/conf.d and restart
#apache. gets rid of the annoying 404 entries in the
#error_log if favicon.ico or robots.txt are not present
<FilesMatch "^(favicon\.ico|robots\.txt)$<span></span>">
        RewriteEngine On
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ /error/HTTP_NOT_FOUND.html.var [L]
</FilesMatch>

the only difference is, that the new version is more precise and not as widespread as the former one. this fixed the problem for us. feel free to use it.

Thursday, 22. March 2007 • trackback url

Add Comment

( to reply to a comment, click the reply link next to the comment )

Comment Title:
Your Name:
Email Address:
Make Public?
Website:
Make Public?

Comment:


Allowed XHTML tags : a, b, i, strong, code, acrynom, blockquote, abbr. Linebreaks will be converted automatically.


Captcha:

captcha image

please type the content of the above image into the following form-field: