Earlier I wanted to keep the redirects out of web.config, because I have many rewrite rules. I was successfull in doing that by using
<rewrite>
<rules configSource="RewriteRules.config" />
</rewrite>
Now the problem is this file is already having many rules, and I am going to use another set of large amount of rules for another domain pointed to same base code. So I want to keep rules for both files on different files like:-
<rewrite>
<rules configSource="RewriteRules_a.config" />
<rules configSource="RewriteRules_b.config" />
</rewrite>
which is not allowed, can anyone suggest how can i fix this situation?? Please note both domains will have different rules and domain addition can be more too in this project.
Any suggestions will be appreciated ...
Simply put, a redirect is a client-side request to have the web browser go to another URL. This means that the URL that you see in the browser will update to the new URL. A rewrite is a server-side rewrite of the URL before it's fully processed by IIS.
The outbound rewrite rule can operate on the content of an HTTP header or on the response body content. This rule needs to replace links in the response content so in the "Matching Scope" drop down list choose "Response".
Can you use create multiple files (for development only) and create post-build rules that concatenate them all into the single rewrite.config file?
This way you can split them into multiple files and version control them during development and the post-build will aggregate them into one file for production purposes.
Does the second domain point to the same application in IIS? If they are different applications you could use the config transformation capabilities of VS to have a single file per domain and only deploy the file you need on each application: http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx
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