Re: URL Rewriting the root folder to a subfolder

“IIS DefaultDocument module may redirect to rewritten URL when URL rewrite module rewrites to a folder. For example, if substitution URL in rewrite rule is “/folder1/folder2” and these folders exist on file system and have default document configured, then DefaultDocument module will redirect web client to “/folder1/folder2/“, thus exposing rewritten URL. To prevent this from happening, use “/” at the end of the substitution URL when rewriting to a folder, e.g. “/folder1/folder2/“”

Which gave me the idea to adjust the Rewrite Url, and discovered its strange behavior. Indeed, if you rewrite to a folder with a default document without the trailing slash it (erroneously?) exposes the rewritten url (as stated above). Adding the trailing slash worked but oddly it then broke asp.net themes. Finally adding the folder/default.aspx (or whatever your default document is) works as you would expect.

Also I did have to remove the condition that it not match on a directory. Here is the final rule fyi.