Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

Repeated hostnames

edited May 2015 in Bug Reports
Hi!
I have a problem with google analytics:
I Receiving data with repeated hostnames (with www and without www), I want to solve this problem with 301 redirect in .htaccess file like so:
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
because I'm afraid to break something, tell me whether it is right and proper method of this decision at all, it would be interesting to know your opinion on this issue.
Thanks in advance!

Comments

  • edited 5:51PM
    Your 301 idea is fine but a bit messy IMO. It may be better to remove the non-www entry from your domain's control panel.

    My .htaccess
    RewriteCond %{HTTP_HOST} ^example.com$
    RewriteRule (.*) http://www.example.com/$1 [R=301,L]
  • edited 5:51PM
    Thanks for the advice and example of .htaccess, it's definitely better!
    I did not quite understand what did you mean about removing non-www entry from control panel, I got ISPManager on my host and in WWW doamins I got my_site.com witout www entry and alias with www.
Sign In or Register to comment.