Reputation: 27
Have the following code in .htaccess which rewrites URLs in WordPress from have no trailing slash to having one. For example, www.domain.com/post -> www.domain.com/post/.
Problem is, it's doing it for sitemap.xml which breaks it. How can I exclude .xml files?
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://domain.com/$1/ [QSA,L,R=301]
Upvotes: 0
Views: 671
Reputation: 74108
Just insert another RewriteCond
excluding URLs ending in .xml
RewriteCond %{REQUEST_URI} !\.xml$
Upvotes: 2