Updated on Kisan Patel
How to redirect URL from WWW to non-WWW in IIS?
Open Web.config file and add following rewrite rule:
<?xml version="1.0" encoding="utf-8"?> <configuration> ... <system.webServer> .... <rewrite> <rules>
... <rule name="CanonicalHostNameRule1"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" pattern="^example\.com$" negate="true" /> </conditions> <action type="Redirect" url="https://example.com/{R:1}" /> </rule> </rules> </rewrite> </system.webServer> ... </configuration>
That’s it.