How to exclude specific file types from the following .htaccess rewrite rule?

hsatterwhite picture hsatterwhite · Mar 31, 2011 · Viewed 11.9k times · Source

How can you exclude specific files types (xml and txt) from the following rewrite rule?

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://website.com/$1/ [QSA,L,R=301]

Answer

M'vy picture M'vy · Mar 31, 2011

What about :

RewriteCond %{REQUEST_URI} !\.(xml|txt)$