I have http://xyz.it/page1 to http://xyz.it/pageN and I need to redirect all pages to http://bar.it/foo and I thought I had solved it with this rule:
<rule name="from-xyz-to-bar" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTP_HOST}" pattern="^xyz\.it$" />
</conditions>
<action type="Redirect" url="http://bar.it/foo" appendQueryString="false" redirectType="Permanent" />
</rule>
But it doesn't work. What my rule is doing is redirecting http://xyz.it/page1 to http://bar.it/page1 and I don't understand where I am wrong.
Please help!
Returns exact URL what you requested. For example, if you have default.aspx file in the root and you will access your website root.
ASP.NET routing is used to dispatch a request to a handler based on the requested URL path. As opposed to URL rewriting, the routing module knows about the handlers and selects the handler that should generate a response for the requested URL. You can think of ASP.NET routing as an advanced handler-mapping mechanism.
A rewrite is a server-side rewrite of the URL before it's fully processed by IIS. This will not change what you see in the browser because the changes are hidden from the user. Useful for search engine optimization by causing the search engine to update the URL.
<rule name="from-xyz-to-bar" stopProcessing="true">
<match url="^$" />
<action type="Redirect" url="http://bar.it/foo" />
</rule>
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