Canonical redirect of www to non www for the same domain Print

  • 21

Two ways to get the result you want:

1) In .htaccess file:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*) http://example.com/$1 [L,R=301]

2) Through the user interface:

In the Domains section click on Redirects, select the type of redirect and the domain from the drop down list and type in the "redirects to" text box the full web address you want to redirect to.
The default option is "Redirect with or without www." This is the option you need.
Very important!!! If you already have indexed results in search engines of the www. version of your website make sure to check the "Wild Card Redirect" box. This will add redirects to "http://www.example.com/page" to "http://example.com/page".

Was this answer helpful?

« Back