seeker_of_bacon seeker_of_bacon - 1 year ago 109
Apache Configuration Question

.htaccess redirects /robots.txt to /robots.txt/

Currently I have the following in


RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ /$1$2/ [R=302,L]

This line
RewriteCond %{REQUEST_FILENAME} !-f
does not exclude txt files. How can I also exclude txt files from the following

Answer Source

You can exclude .txt files using the following condition

RewriteCond %{REQUEST_URI} !\.txt$