Forum Moderators: mack
I've seen this discussed in webmasterworld before but couldn't find the thread.
My domain.com and domain.com/index.php are both indexed by google. Each has a different Pagerank, which I think is because I have used domain.com/index.php in some of my internal links.
Can anyone point me to the subject to resolve this? I think it had something to do with redirects..? I have just changed my internal links to domain.com/
Thanks
Tom
Basically, you need to use a permanent redirect to redirect any existing index or anchor to the canonical resource. This can happen for not only the problem you are experiencing with the index page, but also with the domain (www.example.com versus example.com) as well as uppercase/lowercase URIs (www.example.com/dir/mypage.htm versus www.example.com/dir/MyPage.htm)
Some related threads to get you started (pay close attention to the Matt Cutts of Google link):
trailing slashes and duplicate content [webmasterworld.com]
Are upper- and lower-case URLs the same page? [webmasterworld.com]
http:// and https:// - Duplicate Content? [webmasterworld.com]
I found that very useful, especially the Matt Cutts blog.
So basically I am going to make sure all my links point to mydomain.com/
But to clean up the existing duplicate page I'm a bit unsure. There seems to be a lot of different ways of writing the htaccess, I guess because the problem is different for various people.
It seems like htaccess is the best way to solve the problem? I found this in another thread which seems to suite my case:
# Parse .html and .inc files for server-side includes
AddHandler server-parsed .html .inc
#
#
# Set up to enable mod_rewrite
Options +FollowSymlinks +Includes All -indexes
RewriteEngine on
#
#
# Redirect requests for index.html in any directory to "/" in the same directory
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.+/)?index\.html\ HTTP
RewriteRule ^(.+/)?index\.html$ http://www.example.com/$1 [R=301,L]
#
#
# Redirect requests for resources in non-www domains to same resources in www domain
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
So would replacing the 'html' with 'php', and 'example' with 'mydoamin' have the desired effect? I guess I should learn about htaccess, I haven't used it before...
Thanks