How To Solve Google Analytics Redundant Hostnames
Online Marketing Strategies

How To Solve Google Analytics Redundant Hostnames .

2022-01-30 | 1447 Print Friendly Version of this pagePrint Get a PDF version of this webpagePDF


How To Solve Google Analytics Redundant Hostnames 

Are you having issues with your Google Analytics web traffic not showing your real web traffic counts because of a URL redirect issue? Then this post is for you, as we will be looking at the simple steps to rectify this warning and also get your website traffic capturing the redirects from the redundant hostnames to your primary hostname.

seo web analyst blogger community

In most cases when you see the redundant hostnames error message on your Google Analytics dashboard, what this insinuates is that both URL versions of your domain name are not redirecting properly to the main primary hostname you have chosen to receive or direct web visitors to.

  • www.yourdomain.com/redundant-hostnames-google-analytics
  • yourdomain.com/redundant-hostnames-google-analytics

yourdomain.com does not redirect to https://www.yourdomain.com/

nor
www.yourdomain.com does not redirect to https://www.yourdomain.com/

There are some options being offered on your Google Analytics dashboard to fix these issues, and we are going to walk through them together.

So let's first start off with using the Google Analytics Filter to set up how it reads traffic from which URL;

Go to Admin

seo web analyst blogger community

Click on the All Filters or the Filters Tab, Next click on Add filter button which should take you to a page similar to the image below.

Simply follow the steps below;

seo web analyst blogger community

  1.  Name the Filter name box "consolidation Hostnames" for easy referencing
  2. Select Custom under the Filter Type
  3. Under the drop-down select the option "search and replace"
  4. For Search string  and Replace string use the proper calls that best suit your case

Configure the filter depending on how you want your hostname to appear.

  • Converting WWW to non-www
    • Filter Field: Hostname
    • Search String: ^www.
    • Replace String: leave it empty
  • Converting non-www to WWW
    • Filter Field: Hostname
    • Search String: ^yourdomain.com$
    • Replace String: www.yourdomain.com

After selecting the best option for you simply input them in the right reference as the image above then scroll down to Apply Filter to Views (select the view for your main web property ie yourdomain.com) and then click Save.

In effect, this will solve the redundant hostname in Google Analytics, however, your site will still have 2 separate URLs for each page, in other to fix that you might need to execute a 301 redirect via .htaccess.

A simple solution will be to use the following .htaccess 301 redirects on your .htaccess file, in our case, our redirects were all working fine but due to some web traffic requests to unspecified versions of our domain names, Google analytics started picking up redundant hostnames and splitting our web traffic among the two versions of our domain names instead of following the redirect protocols initiated on .htaccess.

 


RewriteEngine On
RewriteBase /

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^yourdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
RewriteRule .* https://www.yourdomain.com%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^yourdomain.com$
RewriteRule .* https://www.yourdomain.com%{REQUEST_URI} [R=301,L]

Secondly, if you run a WordPress Based website or Blog(s) you can apply the .htaccess code below to resolve your Google Analytics Redundant Hostname Warning: Open your website root .htaccess file and paste this code:

# 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

Please note that you have to change "yourdomain" with your actual domain name.

Implementing this should correctly redirect all your domain versions to https://www.yourdomain.com, you can validate yourself via this tool.

I will also recommend the following informative reads on How to redirect HTTP to HTTPS Using .htaccess and How To 301 Redirect, (AVOID DUPLICATE CONTENT SEO).

Attention: Please note it takes 24hours before Google Analytics resolve Redundant Hostnames Error.


comments powered by Disqus

Ads

Author

authors image profile

Olatunji Adetunji

I am a seo web analyst and have a love for anything online marketing. Have been able to perform researches using the built up internet marketing tool; seo web analyst as a case study and will be using the web marketing tool (platform).

Subscribe RSS

Subscribe with Subscribe with facebook Subscribe with google Subscribe with linkedin Subscribe with TwitterSubscribe with Yahoo   

OR




This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

More Posts From Online Marketing Strategies


Random Blogs




carauctions
Online Marketing Strategies
AuctionCars
Licensedclearing Agent
Licensedclearing Agent
clearingagent