One of the best plugin you can use to perform a redirection in Windows IIS is by installing url rewriter component. Once it has been installed you can easily copy the following code into your web.config file.
Many people wonders which one is actually redirecting www to non www or the other way around. My preference is definitely www to non www because it is shorter and less typing. If you see many of the popular site like facebook or twitter, they all use the shorter url address version.
Here is the code to perform a redirection from www to non www. Remember that you place the rewrite rules inside the system.webServer config section.
<system.webServer> <rewrite> <rules> <rule name="Redirect to non-www" stopProcessing="true"> <match url="(.*)" negate="false"></match> <action type="Redirect" url="https://bytutorial.com/{R:1}"></action> <conditions> <add input="{HTTP_HOST}" pattern="^bytutorial\.com$" negate="true"></add> </conditions> </rule> </rules> </rewrite> </system.webServer>