Why are URLs with my domain name at the end showing up in analytics?

8,562

Solution 1

You can do this by doing the following steps:

  • Login to Google Analytics
  • Click admin (upper right corner)
  • Click on the profile associated with the domain that you're having an issue with.
  • Click profile settings
  • Check the "Default Page" field, if it has your domain name in there, delete it and press apply.

Why?

The Default Page field is for the index.html, index.php or similar. This field allows GA to treat http://yourdomain.com/index.php as the same page as http://yourdomain.com/.

Solution 2

It could happen if you have link like this in your template that is missing the http://

<a href="www.domain.com">

It could happen if you use your domain name in a javascript string. Some bots are known to try to crawl all javascript strings as if there were urls.

var site = 'www.domain.com';

I found your site using the allinurl: operator and google and looked through the source code for couple of the pages. I didn't find anything that resembled either of the above senarios.

It could happen if redirects from the old domain were not working in some cases. I'd think you would be able to test the redirects and find that problem.

So, I'm not sure what is causing it. If you want to fix it, you can redirect away from any url that ends in your domain name with a rewrite rule. The following will strip off the "www.domain.com" bit and redirect to a url without it.

RewriteRule (.*)www.domain.com$ $1 [R=301,L]
Share:
8,562

Related videos on Youtube

Prophet Daniel
Author by

Prophet Daniel

I am the content head of my very own web marketing agency, based out of Mumbai. I am a writer by profession but the dark side of my nature seems to have turned towards programming. I will have my vengeance!! I love learning javascript and ruby and amazed by the power of meta programming and shit I don't know but am very curious about.

Updated on September 18, 2022

Comments

  • Prophet Daniel
    Prophet Daniel over 1 year

    I have a multi-language WordPress site that has been live since the last 3 months and today when I checked Analytics, I saw a lot of weird URLs:

    /menswear-fashion-autumn-winter-2013-2014/www.domain.com
    
    /fashion-history/1960s-1970s/www.domain.com
    
    /fashion-latest-news/www.domain.com
    
    /it/fashion-history/1920s-1930s/www.domain.com
    
    /fashion-history/1950s-1960s/www.domain.com
    
    /fashion-history/1940s-1950s/www.domain.com
    

    As you can see, my domain name is coming after the end of the URL. Of course, these URLs do not exist on the site and are leading to 404 errors.

    Now there is an older site from which this one was migrated and that site is still live. Could that be the problem? Also for reference here is my .htaccess:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # BEGIN WordPress
    #<IfModule mod_rewrite.c>
    #RewriteEngine On
    #RewriteBase /
    #RewriteRule ^index\.php$ - [L]
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule . /index.php [L]
    #</IfModule>
    
    # END WordPress
    
    AddType video/mp4 .mp4 .m4v
    AddType video/webm .webm
    AddType video/ogg .ogv 
    

    What exactly is happening with these URLs and how do I fix it?

  • Prophet Daniel
    Prophet Daniel about 11 years
    Are you absolutely sure about this? This could take a lot of effort to execute. And what code should I use if not code files from my current installations? I don't quite understand
  • Sidh
    Sidh about 11 years
    Use only the image files. wp-content/uploads. No config file nothing.
  • Prophet Daniel
    Prophet Daniel about 11 years
    could you please tell me what exactly made you sure that this was an attack? Did it destroy your data? etc
  • Sidh
    Sidh about 11 years
    You cannot use any .php files, malicious code may have been injected in them.
  • Sidh
    Sidh about 11 years
    In my site, it was showing link of other sites. Some Adult site. Database is not effected.
  • Sidh
    Sidh about 11 years
    For fresh installation see this link webmasters.stackexchange.com/questions/39664/…
  • Stephen Ostermiller
    Stephen Ostermiller about 11 years
    I've never heard of it before.
  • Prophet Daniel
    Prophet Daniel about 11 years
    This is what I tried - it worked - but it took several weeks for analytics to show the changed urls
  • MrWhite
    MrWhite almost 10 years
    I too would question whether this was the result of an "attack" in this instance (and on this more recent question), since the domain appended to the URL is the site's own domain, not another (adult) site.
  • marcelm
    marcelm over 4 years
    Welcome to WM.SE! Please note that your answer doesn't seem to add much over the accepted answer (which was posted 6 years ago). We prefer new answers to cover something that is not already addressed. If you feel like answering questions, perhaps you could have a look at unanswered questions!