Jay
Jay

Reputation: 1404

Webconfig redirecting from www.example.com to http://example.com

Im trying to redirect my website from www.example.com to example.com with the following code but i get 500 error.

<system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect from WWW" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_HOST}" pattern="^www.example.com$" />
          </conditions>
          <action type="Redirect" url="http://example.com/{R:0}" redirectType="Permanent" />
       </rule>
     </rules>
   </rewrite>
</system.webServer>

Would you please let me know what is wrong with my code?

Upvotes: 0

Views: 448

Answers (1)

Paulo Capelo
Paulo Capelo

Reputation: 1092

Is your DNS server setup to resolve example.com, without the www???

that might be your issue

Upvotes: 1

Related Questions