PDA

View Full Version : 301 Redirect index.html to root (.htaccess)



Finne
22 Jul 2010, 09:08 AM
For some reason, Google Webmaster Tools shows that I have crawl errors because of other sites linking to www.ciagent.com/index.html, but that file doesn't exist. I checked the sites that are linking to me, but they just use my root address without index.html in their links.

I use Wordpress, so my index file is index.php

I want to get rid of these crawl errors because I fear I'm losing link juice, so I want to 301 redirect the nonexistent index.html to the root of my website.

This is my current .htaccess code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I tried to add this line:

redirect 301 /index.html http://www.ciagent.com

But this 'breaks' my website.

What can I add to make sure that requests for index.html get properly redirected to my www.ciagent.com root?

Thanks in advance.

aquilax
22 Jul 2010, 10:59 AM
Try this one :


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.htm$ index.php [NC,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>