homepage Welcome to WebmasterWorld Guest from 54.243.13.30
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Duplicate homepage showing up in google tools
duplicate file issue
xert




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

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

 

g1smd




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

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.

xert




msg:4238980
 7:31 pm on Dec 5, 2010 (gmt 0)

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

milosevic




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

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 :)

xert




msg:4239226
 10:43 am on Dec 6, 2010 (gmt 0)

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

Chris

g1smd




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

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!

xert




msg:4239426
 8:28 pm on Dec 6, 2010 (gmt 0)

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

Many thanks, Chris.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved