2

I would like to replace my old domain (oldsite.com) with (newsite.com) and permanently redirect my users. I have the following in my application web.config file:

<rule name="Redirect to new site" stopProcessing="true">
  <match url="(.*)" />
  <conditions>
    <add input="{HTTP_HOST}" negate="true" pattern="^oldsite\.com$" />
  </conditions>
  <action type="Redirect" url="http://newsite.com/{R:1}" redirectType="Permanent" />
</rule>

When I connect to my website, I see that it correctly gets redirected to newsite.com but that goes into an endless loop. Is there anything wrong with this rewrite rule?

GETah
  • 121
  • 4
  • 1
    Are you using host headers? The rule you mention should only be applied to requests arriving at the oldsite.com. Look at http://technet.microsoft.com/en-us/library/cc753195%28v=ws.10%29.aspx – jpe Dec 12 '14 at 09:22
  • Yes I do. My hosting company supports this. By the way, newsite.com is a domain pointer pointing to oldsite.com so the back end is the same if that's what you mean. – GETah Dec 12 '14 at 10:43
  • In any case, check your rules and host header setup, i.e. from where you redirect and where. Your current rule reads to me like "Match URL and if HTTP_HOST does NOT match oldsite.com then perform the action redirect to newsite.com". Is the negation necessary? – jpe Dec 12 '14 at 11:27
  • I tried without the negation and the redirection does not happen at all :( – GETah Dec 13 '14 at 14:22
  • It seems that you want to say that when the input is NOT newsite.com then redirect to newsite.com. So try newsite.com in your pattern with negation enabled. Since your pattern includes string start and end make sure the full HTTP_HOST is included. – jpe Dec 13 '14 at 14:33

0 Answers0