Google Analytics – Redundant Hostnames


(Redirecting non www URL's to www URL's)

KB ID 0001016 Dtd 04/12/14


I noticed this a while back, apparently Google Analytics started flagging this for many users on October 14th 2014. But I've only just got round to sorting it out.

Google Redundant Hostnames

If you are seeing this error its because your site is 'addressable' in more than one way, in my case you could get to me via http://petenetlive and I could have registered both in 'Google Webmaster Tools', and set one as a preferred site, but I didn't want to update my Analytics code (I've got custom stuff in there I don't want to re-write). So my next option is to do a '301 redirect'.


1. I use Apache web server, and I have my own VPS, so I can pretty much do what I want, If you side is hosted you may need to ask them to ensure that the rewrite_module is loaded on your web server. If you have your own you will need to take a look at your httpd.conf file.

Edit httpd.conf

2. Make sure that (like below), there is a line that is not commented out, that reads;

LoadModule rewrite_module modules/mod_rewrite,so

Google Redundant Hostnames

3. Now in the root of your website edit (or create) the .htaccess file. And pate the following onto the end of it, (change accordingly);

RewriteEngine On RewriteCond %{HTTP_HOST} ^ RewriteRule (.*)$1 [R=301,L]

Edit .htaccess

4. Save and upload the file (If using Notepad, make sure it does not put a .txt extension on the end of the filename - it should have NO extension).

5. Now go to, (It will probably still work because your browser will attempt to load the page from its cache, so press CTRL+F5 to force refresh). If should redirect to http://www/

6. To make doubly sure you can go here and type in it should say something like;

HTTP/1.1 301 Moved Permanently Date => Thu, 04 Dec 2014 19:41:48 GMT Server => Apache/2.2.15 (CentOS) Location => Vary => Accept-Encoding Content-Type => text/html; charset=iso-8859-1 <

7. Back in Google Analytics, select 'Check again'.

Google Redundant Hostnames

5. It should say this.

Google Hostnames Pending verification

6. Then it will say this 'for ages!'.

Google Redundant Hostnames


Related Articles, References, Credits, or External Links


Author: Migrated

Share This Post On