IIS URl Rewrite working inconsistently?
- by Don Jones
I'm having some oddness with the URL rewriting in IIS 7. Here's my Web.config (below). You'll see "imported rule 3," which grabs attempts to access /sitemap.xml and redirects them to /sitemap/index. That rule works great.
Right below it is imported rule 4, which grabs attempts to access /wlwmanifest.xml and redirects them to /mwapi/wlwmanifest. That rule does NOT work.
(BTW, I do know it's "rewriting" not "redirecting" - that's what I want).
So... why would two identically-configured rules not work the same way? Order makes no different; Imported Rule 4 doesn't work even if it's in the first position.
Thanks for any advice!
EDIT: Let me represent the rules in .htaccess format so they don't get eaten :)
RewriteEngine On
# skip existing files and folders
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# get special XML files
RewriteRule ^(.*)sitemap.xml$ /sitemap/index [NC]
RewriteRule ^(.*)wlwmanifest.xml$ /mwapi/index [NC]
# send everything to index
RewriteRule ^.*$ index.php [NC,L]
The "sitemap" rewrite rule works fine; the 'wlwmanifest' rule returns a "not found." Weird.