Using URL Rewrite on Windows Hosting



Rewrite rules should be placed in your web.config file. 
 
An example rule to redirect from non-www to www:


<rewrite>
<rules>
<rule name="Redirect domain.com to www" patternsyntax="Wildcard" stopprocessing="true">
<match url="*">
<conditions>
<add input="{HTTP_HOST}" pattern="domain.com">
</add></conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}">
</action></match></rule>
</rules>
</rewrite>


For more info and examples for using URL rewrite, please see the following:
 

Was this answer helpful?

 Print this Article

Also Read

Where can I get a .publishsettings XML file for WebMatrix?

To obtain the XML file to use to upload/edit in WebMatrix, log into your Plesk account...

How do I connect via RDP on my Windows VPS?

Windows Firewall is active by default, so RDP access will first need to allowed in the firewall...

Plesk says ASP.NET 4.0, but I need 4.5

It's because 4.5 is simply an update of 4.0, therefore in Plesk the version appears as 4.0...

Cannot access WebAdmin in Plesk

In order to use the WebAdmin, your domain name is required to connect.   If you are not...

Enabling HTTP Compression In Windows Hosting

In your web.config file, add the following line of code to enable HTTP...