Hafeez Khan
Hafeez Khan

Reputation: 487

Redirect to sub domain without changing URL- IIS

We have a website www.A.Com and when I browse the URL www.A.Com/loc
I need to get redirected to sub-domain www.loc.A.Com which is hosted by SEO provider and show the page hosted by them.

The main requirement is we should not change the URL i.e. URL should remain www.A.Com/loc

We tried with URL Write module by defining the below Rule

<rewrite>
  <rules>
    <rule name="ProxyExample" stopProcessing="true">
      <match url="^locations/?(.*)" />
      <action type="Rewrite" url="http://A.Locations.com/{R:1}" />
      <serverVariables>
        <set name="HTTP_ACCEPT_ENCODING" value="" />
      </serverVariables>
    </rule>
  </rules>
</rewrite>

One Note is Our Website is hosted on Azure App Service

Upvotes: 1

Views: 1508

Answers (1)

Victor Leontyev
Victor Leontyev

Reputation: 8736

Your rule should work if you will remove serverVariables:

<rule name="ProxyExample" stopProcessing="true">
  <match url="^locations/?(.*)" />
  <action type="Rewrite" url="http://A.Locations.com/{R:1}" />
</rule>

Upvotes: 1

Related Questions