Welcome to WebmasterWorld Guest from 34.229.126.29

Forum Moderators: phranque

Multiple Homepage URLs in google analytics

Multiple Homepage URLs Error

     
8:21 pm on May 12, 2019 (gmt 0)

New User

5+ Year Member

joined:Aug 19, 2013
posts: 17
votes: 0


Hello all,

Today i got this Multiple Homepage URLs error in google analytics i'm really confused about this error. my website load without index.php
eg. www.mydomainname.com not www.mydomainname.com/index.php

Can someone help me

Thank you
8:54 pm on May 12, 2019 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4296
votes: 288


If you visit https://www.example.com/index.php does it 301 to https://www.example.com/ - and if you visit https://example.com/ does it also 301 to the same https://www.example.com/ URL? Same result if you visit http://www.example.com/ ?
9:08 pm on May 12, 2019 (gmt 0)

New User

5+ Year Member

joined:Aug 19, 2013
posts: 17
votes: 0


Yes that is correct everything
eg. http://www.example.com/
http://example.com/

Except for https://www.example.com/index.php
9:23 pm on May 12, 2019 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15638
votes: 795


Yes that is correct everything
We need a few more verbs.

Do the two URLs
http://www.example.com/
http://example.com/
both serve content, OR does one of them redirect to the other?

Does the URL
https://www.example.com/index.php
serve content, OR does it redirect to www.example.com ?

And what about http vs. https? Your first example says http, and the second says https. Is the site served both ways, or are http requests redirected to https? I make that eight possible ways (2^3) to reach the front page.
9:45 pm on May 12, 2019 (gmt 0)

New User

5+ Year Member

joined:Aug 19, 2013
posts: 17
votes: 0


Sorry i edit the comment right after i submit. i will try to be more clear.

Originally my site uses http:// i have setup SSL to my website using cloudflare and set 301 Permanent redirect in page rules.

So if go to http://example.com it will redirect to https://www.example.com
but when i go to http://example.com/index.php or https://example.com/index.php it will show as https://www.example.com/index.php
10:14 pm on May 12, 2019 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4296
votes: 288


If your site is hosted on Apache [webmasterworld.com] server you can add a rewrite rule to 301 redirect index.php to the same homepage URL as you are handling with cloudflare by using .htaccess. If your server is IIS [webmasterworld.com] I'm pretty sure there is a way to address that there as well. If that is what you need, your best bet is to go to the right one of those forums for best assistance.

Not that the Webmaster General forum doesn't want to help, but specialized help is better than general suggestions for getting it right. ;)
10:45 pm on May 12, 2019 (gmt 0)

New User

5+ Year Member

joined:Aug 19, 2013
posts: 17
votes: 0


i add this rules in to my .htaccess file

  RewriteEngine On

# index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]


Now index.php redirect to https://www.example.com

I will wait and see if this fixed google analytics error it will take 24hrs for google to recheck i believe.
12:46 am on May 13, 2019 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11682
votes: 205


RewriteRule ^(.*)index\.php$ /$1 [R=301,L]

you should specify the full canonical protocol and hostname in the substitution string for the RewriteRule.
12:52 am on May 13, 2019 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15638
votes: 795


i add this rules in to my .htaccess file
That's one way. Another--there are many possible variations--is
RewriteCond %{REQUEST_URI} ^/((?:\w+/)*)index\.php
RewriteRule index\.php https://www.example.com/%1 [R=301,NS,L]
I recommend the NS flag (“no subrequest”) because then the server simply doesn't have to evaluate conditions when it's an internal request, in this case the one that serves up your directory index file. This, in turn, means that THE_REQUEST isn’t needed in the condition.

Try to avoid using .* anywhere other than the end of a pattern, because it's inefficient: the server captures all the way to the end, and then has to backtrack “Oh, whoops, I was supposed to leave room for index.php”. You don't need a closing anchor in the pattern, unless you happen to have legitimate URLs that contain more stuff after the "index.php" part.

... and now we’ve definitely departed from Webmaster General :(
3:09 am on May 13, 2019 (gmt 0)

New User

5+ Year Member

joined:Aug 19, 2013
posts: 17
votes: 0


Ok i think something is wrong here. when i add the suggested code website loads fine https://www.example.com/index.php redirect to https://www.example.com

But the problem is in my website script i'm using a ffmpeg conversion script and every time when someone add a link to convert it redirect to index.php for the output. since i have edit my .htaccess file the script stop work because the code i add redirect index.php back to non "www.example.com"

Any advice or solution for this
3:44 am on May 13, 2019 (gmt 0)

Administrator from US 

WebmasterWorld Administrator not2easy is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 27, 2006
posts:4296
votes: 288


Can your script be edited to redirect to "/" rather than "/index.php"? Whatever is sending it to /index.php should have that index.php in its settings or variables. Replace it with only /.
6:57 am on May 13, 2019 (gmt 0)

New User

5+ Year Member

joined:Aug 19, 2013
posts: 17
votes: 0


Honestly i cant think of which file to edit in my script.

Something seems to work here. in google analytics i went to "View Settings" and there i put "index.php" into Default Page box now the error resolved

Plz check the images

[ibb.co ]
[ibb.co ]

Thank you
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members