Forum Moderators: Robert Charlton & goodroi
Thank you.
Rachel
Now today, our index page is nowhere to be found for our major keyword.
Just for good clarity so we can try and help; when you say no where to be found, do you mean positively not in the first 1,000 results? We have had experiences of the 950 "relocation" effect, and all kinds of other positions throughout 1,000 from time to time. Landing in the 900’s stings the same, but is a bit different, than outside the 1,000.
Rachel
Thanks.
Rachel
Just do three more checks:
1. If you ask for either domain.com/index.html or www.domain.com/index.html that each of those does a single redirect to the canonical domain, not a chain of redirects.
2. Check that index filename URLs in folders also redirect correctly, omitting the filename, but retaining the folder name in the target URL.
3. That all your internally pointing links no longer include the index file filename anywhere in the link URL (that is, your users don't pass through any redirects while normally navigating the site).
example.com now goes to www.example.com
example.com/index.html now goes to www.example.com
www.example.com/index.html now goes to www.example.com
example.com/directory/ now goes to www.example.com/directory/
example.com/anyfile.html now goes to www.example.com/anyfile.html
I used the following to do this:
Options +Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_URI}!(.*)/$
RewriteRule ^(.*)$ http://www.example.com/$1/ [L,R=301]
RewriteCond %{THE_REQUEST} ^.*\/index\.html?
RewriteRule ^(.*)index\.html?$ http://www.example.com/$1 [R=301,L]
If you ask for example.com/index.html it is redirected to www.example.com/index.html using your first rule, and that is then redirected to www.example.com/ using your final rule.
You need to change the order of the rules to avoid that happening.
.
While you can use GWT to signal which one you prefer to be used, that only works for Google. It does not stop visitors seeing incorrect URLs in their browser address bar which they then cut and paste and use as incoming links to your site. Only a proper redirect stops that, and that is always the preferred method.
[edited by: g1smd at 7:55 pm (utc) on Jan. 10, 2008]
Is there any reason why that won't clear this problem (instead of the .htaccess)
Yes - first of all Google does not guarantee that setting your preference in GWT will do anything ("While Google doesn't guarantee that we'll show your URLs in the form that you prefer, we will use your choice as a suggestion to improve our indexing.")
Second, setting a GWT preference may keep your non-preferred form out of the SERP, but what about the flow of link juice and PR through your entire site? From my viewpoint, the 301 redirect fixes the core problem, but the GWT preference does not.