How to Force or Remove WWW on an IIS Site in Windows Dedicated solution?

 

Using website for your business give you a lot of advantages and it also helps your business to get more customer by showcase your business products and services to the people around you and also to the people across the globe. And for this reason today you can see a lot of business are using the website and Windows web hosting services.  And today most of the people like to use Windows operating system in their hosting and the reason behind it is that they can easily manage and handle their website and they can also install and run Windows applications.

 

So today if you are already using a website for your business and now if you are looking for information on how to Force or Remove WWW on an IIS Site in Windows Dedicated server then here is the complete information on it. So today if you like to force or remove the WWW in the URL for your domain name for SEO or for SSL reasons then you follow this--


 

Forcing WWW

 

--->>> First you need to connect to your website's web.config file.

 

--->>> In there you need to search for a file named <system.webserver> or </handlers> line and just below it, press enter to add a new line.

 

--->>> Now in there paste the below code at the new line-

 

<rewrite>

 <rules>

  <clear />

   <rule name="WWW Rewrite" enabled="true">

     <match url="(.*)" />

       <conditions>

         <add input="{HTTP_HOST}" negate="true" pattern="^www\.(.*)$" />

       </conditions>

       <action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}" appendQueryString="true" redirectType="Permanent" />

   </rule>

 </rules>

</rewrite>

 

--->>> Next click Save the web.config.

 

Remove WWW

 

--->>> To remove the WWW first you need to connect your website's web.config file.

 

--->>> In web.config file search for a line  <system.webserver> or </handlers> once when you see the line and jsut below it press enter to add a new line.

 

--->>> Now in there you need to paste the below code at the new line-

 

<rewrite>

 <rules>

   <rule name="Remove WWW" stopProcessing="true">

     <match url=".*" ignoreCase="true" />

     <conditions logicalGrouping="MatchAll">

       <add input="{HTTP_HOST}" pattern="^www\.(.*)$" />

     </conditions>

     <action type="Redirect" url="http://{C:1}/{R:0}" appendQueryString="true" redirectType="Permanent" />

   </rule>

 </rules>

</rewrite>

 

--->>> At last you need to click Save the web.config file.