Welcome to WebmasterWorld Guest from

Message Too Old, No Replies

Redirecting example.com/index.php to example.com

Google thinks they are separate pages

3:03 am on Sep 14, 2006 (gmt 0)

Full Member

10+ Year Member

joined:Dec 1, 2002
votes: 0

It seems that google treats www.wexample.com and www.example.com/index.php as two separate entities. One has PR5 and the other has PR4. Does anybody know how can i effectively redirect index.php to the root(www.example.com)?

[edited by: tedster at 4:14 am (utc) on Sep. 14, 2006]
[edit reason] use example.com [/edit]

4:30 am on Sept 14, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
votes: 0

You're correct that these are two different URLs and if both are indexed in Google you can get "split PR".

Assuming you are on an Apache server, here's a thread with a Rewrite solution [webmasterworld.com] from jdMorgan that you can use in your .htaccess file:

# mod_rewrite setup
Options +FollowSymLinks
RewriteEngine on
# Redirect direct client /index.html requests to "/" (does not affect DirectoryIndex accesses)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html
RewriteRule ^index\.html$ http://example.com/ [R=301,L]
3:15 pm on Sept 15, 2006 (gmt 0)

New User

5+ Year Member

joined:Mar 25, 2006
posts: 7
votes: 0


Is this also a possibility on IIS? I have a site where both http://www.example.com/default.aspx and http://www.example.com/ are listed.
The problem is that IIS adds the default.aspx automatically as the defaukt document, otherwise it does not know where the results from http://www.example.com/ are supposed to come from.
I cannot find any difference in the request header or content between the requests for both pages.

4:41 pm on Sept 15, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 1, 2005
votes: 0

It looks is working fine to me in this way:

header( "HTTP/1.1 301 Moved Permanently" );
header( "Status: 301 Moved Permanently" );

7:23 pm on Sept 16, 2006 (gmt 0)

Senior Member

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

joined:July 3, 2002
votes: 0

For IIS it is even worse, you have yet more duplicates at /Default.asp and /default.ASP and many others, etc.