Did you receive a Google analytics notification for ‘Redundant Hostnames‘. Don’t panic if you see this error in your google analytics account. This is a feature Google announced in 2014 for Google Analytics. Through this Google Analytics users will be warned about ‘redundant hostnames’ if their website is accessible with more than one hostnames. In simple terms, if you website can be accessed with ‘www’ and without ‘www’ prefix you might get this error notification.

Let’s understand in details what is Redundant Hostnames.

If your website is accessible with multiple hostnames, search engine robots might face indexing your website properly. Redundant hostnames issue can also occur if a website can be access by its IP address.

For e.g domain.com can be accessed via domain.com or www.domain.com or https://www.domain.com

For SEO perspective it is really a bad practice to have your website open via different URLs. It can seriously hamper your SEO campaign. Search engines will have a hard time finding the actual pages and indexing will therefore be slower.

How to fix the Redundant Hostnames ?

Its very easy to get rid of the redundant hostnames issue. Below are the different methods to resolve the redundant hostname issue-

Method 1: Set up a 301 redirect

If your website is facing this issue, probably the 301 redirect is missing from the website. 301 redirect or permanent redirect. Once you have set up the 301 redirect, you need to work on your robots.txt files. Open your robots.txt file and add your preferred host. E.g- If you own domain.com and want your preferred host to be www.domain.com, simply add in robots.txt
Host:www.domain.com you can set up a permanent redirect via code or htaccess file.

Using Code:

IIS Redirect

In internet services manager, right click on the file or folder you wish to redirect
Select the radio titled “a redirection to a URL”.
Enter the redirection page
Check “The exact url entered above” and the “A permanent redirection for this resource”
Click on ‘Apply’
ColdFusion Redirect

PHP Redirect

<? Header( “HTTP/1.1 301 Moved Permanently” ); Header( “Location: http://www.new-url.com” ); ?>

ASP Redirect

<%@ Language=VBScript %>
<% Response.Status=”301 Moved Permanently” Response.AddHeader “Location”,”http://www.new-url.com/” %>

ASP .NET Redirect


JSP (Java) Redirect

<% response.setStatus(301); response.setHeader( “Location”, “http://www.new-url.com/” ); response.setHeader( “Connection”, “close” ); %>

CGI PERL Redirect

$q = new CGI;
print $q->redirect(“http://www.new-url.com/”);

Ruby on Rails Redirect

def old_action
headers[“Status”] = “301 Moved Permanently”
redirect_to “http://www.new-url.com/”

Using htaccess:

You can access .htaccess file by using cpanel or FTP client. The .htaccess file should be in the public_html folder or your website name folder. Create a backup of .htaccess file to your local computer by downloading it. Next, right-click on the .htaccess file and click edit. If you have a wordpress website or are a wordpress developer, your .htaccess file might look something like this:

#BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
When the .htaccess file opens, add the following line of rules to it:

RewriteEngine On (if this line exists, then don’t add this line again).
# Rewrite all requests to the ‘www’ version
RewriteCond %{HTTP_HOST} ^mydomain.com$ [NC]
RewriteRule ^.*$ http://www.yourdomain.com%{REQUEST_URI} [R=301,L]
Note: Replace yourdomain.com with your domain name address.

After the edit, your .htaccess file will look like this:

# BEGIN WordPress

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [NC]
RewriteRule ^.*$ http://www.yourdomain.com%{REQUEST_URI} [R=301,L]
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Method 2: Google Webmaster Tools

Google Webmaster Tools has the option to set a preferred hostname as well. Login to your Google Webmaster account and open ‘site settings’. Here you will find force www. or Non-www version of the URL option. Before you do this, you should have both the www version and non www version of the website verified in the Google webmaster tools.

Once you select the preferred hostname, your will get rid of the redundant hostname issue. To ensure check the website by opening with www and without www. You should be redirected to the preferred URL. Now login to your Google analytics account and click on the redundant hostname warning message and submit it for review.

It takes 24 hours or more before Google review your website for the issue. Once its review you will get a confirmation from Google regarding the issue resolution.  If you are unable to resolve the issue, you can take help of our expert SEO services to get the issue fixed for you.