Google Analytics don't detect subdomain after redirect all subdomain to http

自古美人都是妖i 提交于 2020-01-06 12:43:24

问题


My website using SSL: https://sharengay.com . I need to add a subdomain like http://hdonline.sharengay.com

I added this code into .htacess file:

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Yes, it works perfectly. URL: http://hdonline.sharengay.com is available. Have two the problem when adding this code.

The first problem: When any user visit URL: http://hdonline.sharengay.com . Google Analytics can't detect from the domain (https://sharengay) or subdomain(http://hdonline.sharengay.com). It found it like one URL: \ - like domain.

Here is image easy to know:

At I mark in the picture, I tried to visit http://hdonline.sharengay.com but Google Analytics detect is /.

The second problem: - I think the problem is not related with code added on .htaccess

Normally, each user visits my site range 2 - 3 minutes. From add this code to .htaccess, time visit about 40 seconds. I don't know to add this code to .htaccess is affect to time view on my website. I think: "it's not". But the result is opposite. The subdomain is got video from a service in my country, I think the user can stay here for more than 2 minutes. Instead of only 40s - 1m40s.

来源:https://stackoverflow.com/questions/50803894/google-analytics-dont-detect-subdomain-after-redirect-all-subdomain-to-http

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!