• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

How do I remove the 'www' from the URL?

A

Andy-Free

Guest
Hi, I'm not sure if I'm in the right place to ask this..


I'm trying to create a URL rewrite rule that removes the www from the URL.

My web host is using Plesk (v9.5) on Windows 2008 (IIS 7 - I don't know if it's 7.0 or 7.5)

I can create a windows hosting rule that ADDS the www to a URL without it (e.g. http://example.com -> http://www.example.com), but I can't get the converse rule to work.

I have verified that the removal rule is correct by generating and testing it with the IIS 7 Rewrite Extension, which I found in Scott Guthrie's blog entry: http://weblogs.asp.net/scottgu/arch...problems-using-the-url-rewrite-extension.aspx

Here's the rule as I have it so far:

<system.webServer>
<rewrite>
<rules>
<rule name="remove www" stopProcessing="true">
<match url="(www.*)" />
<action type="Rewrite" url="http://example.com" />
</rule>
</rules>
</rewrite>
</system.webServer>

I've also tried the default rule that the IIS Rewrite Extension creates which removes any sub-domain prefix (e.g. http://blog.example.com -> http://example.com, but that doesn't work either - the URL doesn't get rewritten and the www remains.

I've asked my web host for assistance, but I thought I'd ask here as well :)
 
Hi Andy,

Did you have any luck with this?

Please explain how you force the WWW on the URL?

I have just changed from linux to windows server (Plesk 9.5.1) and need to have my http://site load as http://www.site

My .htaccess RewriteEngine On RewriteCond no longer works.

Many thanks!
Andy
 
For others looking, I have found out how to use mod_rewrite on a Windows Server.

http://www.iis.net/download/urlrewrite

Download the module on your server and automatically install it. Then go to your IIS7 control panel and under domain > IIS you should find the URL rewrite module. Open it and 'add rule' and there is a template for 'canonical domain name'

If you want to show http://domain.com add this to the primary host name, if you prefer http://www.domain.com, then add this to the primary host name.

HIH

http://learn.iis.net/page.aspx/664/using-url-rewrite-module-20/
 
Back
Top