IIS URl Rewrite working inconsistently?
Posted
by Don Jones
on Server Fault
See other posts from Server Fault
or by Don Jones
Published on 2009-11-23T01:17:14Z
Indexed on
2010/04/05
19:03 UTC
Read the original article
Hit count: 360
wlwmanifest
|url-rewriting
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.
© Server Fault or respective owner