• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    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. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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