View Full Version : RewriteRule trouble

09-11-2010, 04:14 AM

Options +FollowSymlinks
RewriteEngine On
RewriteBase /

RewriteRule ^(.*)\.xml$ $1 [L,R=301]

The goal is to strip off the .xml at the end, similar to removing a .php or .html. This currently is recursive, though I don't see how. Using ^(.*)\.xml$ it should match any amount of anything but end of line, ending with .xml, then rewrite everything EXCEPT the .xml, yeah?


RewriteRule $1 ^(.*)\.xml$ [L,R=301]

RewriteCond %{REQUEST_URI} xml$

RewriteRule ^(.*)\.xml$ $1 [L,R=301]
That does what I wanted it to do.

09-15-2010, 07:59 AM
Try this..

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.xml -f
RewriteRule ^(.*)$ $1.xml