Fix Google Analytics Redundant Hostnames problem
Google Analytics alerted me to a "redundant hostnames" problem today. From the message, appparently, Google Analytics is receiving data streaming from two version of my website instead of one, the non-www and the www version.
To fix this problem, I need to tweak the NGINX configuration from this :
server {
listen 80;
server_name socketloop.com www.socketloop.com;
return 301 https://www.socketloop.com$request_uri;
rewrite ^ https://www.socketloop.com$request_uri? permanent;
to this :
server {
listen 80;
server_name socketloop.com;
rewrite ^/(.*)$ https://socketloop.com$request_uri? permanent;
Instead of two server names, now it has only one with the new server_name socketloop.com;
NGINX parameter and redirect every request to the https
version with the rewrite ^/(.*)$ https://socketloop.com$request_uri? permanent;
parameter.
After Google Analytics re-verify the new configuration, the problem is now marked as resolved.
Hope this tutorial may be useful to you.
Reference :
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+21.9k Fix "Failed to start php5-fpm.service: Unit php5-fpm.service is masked."
+20.1k Golang : Convert seconds to human readable time format example
+10.5k Golang : Bubble sort example
+15.6k Golang : Get checkbox or extract multipart form data value example
+9.8k Golang : Turn string or text file into slice example
+5.9k Golang : Extract unicode string from another unicode string example
+26.3k Golang : Convert(cast) string to uint8 type and back to string
+11.5k Get form post value in Go
+5.6k Unix/Linux : How to find out the hard disk size?
+4.6k Mac OSX : Get disk partitions' size, type and name
+51.8k Golang : How to get time in milliseconds?
+4.5k Linux : sudo yum updates not working