|index.php and home.php... both indexed and receiving traffic|
I've just begun to work on a site that has the index.php and home.php both indexed and both receiving traffic.
- There is no default page set in Google Analytics
- Home.php receives 15.36% of the traffic
- / receives 13.76% of the traffice
- Index.php receives a small amount of traffic
I could presume / is home.php, but I'm not 100% sure. If I decide to set the default page as home.php is a 301 redirect from index.php to home.php the way to go?
Thanks in advance.
Yes, a 301 is the best. However, the fullest best practice is to use either www.example.com or just example.com as the canonical url - without any page name at all. I appreciate that with some servers this isn't practical without a lot of reconfiguration, but if you can take this approach, I'd say do it.
Also, I assumed that you were talking about Google traffic with those percentages - am I correct?
The best solution is in two steps:
- Make it a policy never to link to an directory index document (e.g. index.htm, default.asp and so on). Always link to the full host name (http://www.example.com/) or the root of the directory (http://www.example.com/directory/)
- Permanently redirect (i.e. with an HTTP 301 status code) any requests for duplicate URLs to a single destination - in this case redirect /home.php and/or /index.php to /
The second is slightly more difficult to achieve technically, but if you're on Apache, you'll find a number of references to htaccess-based fixes courtesy of the apache forum [webmasterworld.com], e.g. removing index.php from 301 redirect [webmasterworld.com].
The easy way to check is to visit all of the URLs directly, and compare the content. Otherwise, you most likely have a list of default directory indexes specified in an htaccess file or set by your web hosting company.
I would recommend doing the redirects on the server as suggested, and not setting a preference in Google Webmaster Tools at all, as that may only mask your problems.
The site could well have external inbounds to a large combination of urls... to "/", to "/home.php" and to "/index.php"... with or without the www. It's best to use proper redirects to get the links redirected and the urls all canonicalized.
I don't know that we're sure that Webmaster Tools is going to assign proper linking credit to all the variants. A proper redirect will.
There's further discussion of canonical issues in this thread, which you can find in the Duplicate Content section of Hot Topics, always pinned to the top of this forum's home page....
Canonical URL Issues [webmasterworld.com] - many ways to introduce duplicates
There are no cononical url issues as http://example.com is redirect to http://www.example.com. The issue is with:
Thanks for the suggestions and help everybody.
[edited by: Robert_Charlton at 9:42 pm (utc) on June 20, 2009]
[edit reason] changed to example.com - it can never be owned [/edit]
Find out which *file* is being served when you request the URL "/".
Change all links that currently point to that filename to instead point to "/".
Redirect requests for that filename in the URL to instead request "/".
Is the "other" filename serving the same content as the above?
If so, then redirect requests for that filename to "/" too.
If it serves different content, then leave that one alone.
Just to be clear, this *is* a URL canonicalization issue. The domain canonicalization has evidently been taken care of, but you've apparently got three URLs for the same page, and therefore, at least two of those URLs are non-canonical.