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
+11.8k Golang : Find age or leap age from date of birth example
+5.1k Golang : Calculate a pip value and distance to target profit example
+9.5k Golang : Detect Pascal, Kebab, Screaming Snake and Camel cases
+5.5k Gogland : Datasource explorer
+9.3k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+19.2k Mac OSX : Homebrew and Golang
+11.5k Golang : Delay or limit HTTP requests example
+26.7k Golang : Encrypt and decrypt data with AES crypto
+9.7k Golang : How to generate Code 39 barcode?
+7.3k Golang : Of hash table and hash map
+6.7k Golang : How to determine if request or crawl is from Google robots
+19.7k Golang : Close channel after ticker stopped example