Alternatively:
Apache Webserver: RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Windows Server/IIS:
-
Start Internet Services Manager. or start the IIS Snap-in in Microsoft Management Console (MMC).
-
Click to expand * server name, where server name is the name of the server.
-
Right-click either the Web site or the folder that you want to redirect, and then click Properties.
-
Click one of the following tabs that is appropriate to your situation:
-
Home Directory
-
Virtual Directory
-
Directory
-
Under When connecting to this resource, the content should come from, click A redirection to a URL.
-
Type the URL of the destination folder or Web site in the Redirect to box.
For example, to redirect all requests for files located at www.mycompany.com to mycompany.com type http://mycompany.com
- Click OK.