Welcome to WebmasterWorld Guest from 54.167.155.147

Forum Moderators: incrediBILL

Message Too Old, No Replies

Duplicate homepage showing up in google tools

duplicate file issue

   
4:24 pm on Dec 5, 2010 (gmt 0)

5+ Year Member



Hi,

Had a drop in search ranking recently and when checked google webmaster tools account found that it listed duplicate title tags in www.*******.co.uk/ and www.*******.co.uk/index.php

I have only ever built www.*******.co.uk/index.php so am baffled as to how the other one can exist - when viewing the server files on ftp this is the only one to show and I cannot see the other file

Can anyone shed light into the issue ?

Many thanks.

Chris
6:54 pm on Dec 5, 2010 (gmt 0)

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



The canonical URL for the root of a site is www.example.com/ with trailing slash.

This is the preferred URL. Although you have a file at www.example.com/index.php, using that as the URL is non-optimal. Should you change your site to work with an index.html file, the previous URL will no longer work.

Not so for www.example.com/ though; that URL will always work.

The solution is to change all links on your site to point to www.example.com/ with the trailing slash included and to set up a redirect such that when index.php is requested, user is redirected to www.example.com/ using a 301 response code.
7:31 pm on Dec 5, 2010 (gmt 0)

5+ Year Member



Thanks g1smd. I've noticed that the way I have set internal page links back to the homepage is to use href="index.php". Possibly this has been my error. I'm starting to believe homepage links should be set as href="/"
I've tried an htaccess redirect with the following but it simply makes the site unavailable ;

redirect 301 /index.php [*******.co.uk...]

Chris
10:15 am on Dec 6, 2010 (gmt 0)

5+ Year Member



xert, redirect should be something like:

RewriteRule ^(.*)/index\.php$ http://www.example.com/$1 [R=301,L,NC]

NB just wrote this off the top of my head without testing so there is some sort of law that says it will have a syntax error or won't work :)
10:43 am on Dec 6, 2010 (gmt 0)

5+ Year Member



Many thanks for your help milosevic. I'll give it another bash !
Best regards

Chris
2:37 pm on Dec 6, 2010 (gmt 0)

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



The (.*) in that pattern makes the code very inefficient and must be avoided. Try this:

# Externally redirect direct client requests for 
# /index.php to / and for <path>/index.php to <path>/
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index.php\ HTTP/
RewriteRule ^(([^/]+/)*)index.php$ http://www.example.com/$1 [R=301,L]


When done, run Xenu LinkSleuth over your site. Make sure that none of your internal links invoke redirects. Fix any links that do!
8:28 pm on Dec 6, 2010 (gmt 0)

5+ Year Member



Excellent advice. Ran LinkSleuth and found 7 broken links - now fixed.

Many thanks, Chris.