Is it possible to move the rules created by the IIS7 rewrite module from the root web config into its own web config file like you can with appsettings and if so how?
IIS Rewrite Module Problem Uninstall the Rewrite Module from Windows Features. Go to the Web Platform Installer. Pick Url Rewrite from Products | Server section and install. Restart IIS.
I can't seem to get it working, but the way it's described is:
<rewrite>
<rewriteMaps configSource="external.config">
</rewriteMaps>
</rewrite>
Then in the external.config file add your rules:
<rewriteMaps>
<rewriteMap ...
...
</rewriteMaps>
You have to do this with the entire rewriteMaps section: according to this forum post, you can't do this with the rewriteMap: http://forums.iis.net/t/1154113.aspx
This works for me in web.config:
<system.webServer>
<rewrite>
<rules configSource="web.rules.config" />
</rewrite>
</system.webServer>
One cool thing is that the IIS Configuration Editor respects this external file when you edit the rules and writes the changes back to the external file.
If you put:
<system.webServer>
<rewrite configSource="web.rules.config" />
</system.webServer>
it won't work, you get HTTP error 500.19 Internal server error:
Error Code: 0x8007000d
Config Error: Unrecognized attribute 'configSource'
Can anyone point to the definitive MSDN help page on the rewrite
element and the configSource
attribute? The MSDN article on system.webServer does not mention the rewrite element and I can't find an MSDN page via google.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With