301 redirect from "/index.html" to root if index.html not exist

Posted by Andrij Muzychka on Pro Webmasters See other posts from Pro Webmasters or by Andrij Muzychka
Published on 2013-04-03T10:04:30Z Indexed on 2013/11/01 10:25 UTC
Read the original article Hit count: 442

Filed under:
|
|

Can I create 301 redirect from "index.html" to root directory if file "index.html" not exist?

For example: link "http://example.com/index.html" show "404 Error" page.

I need 301 redirect to root directory: "http://example.com/"

in .htaccess I add rule:

Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.*/index.html 
RewriteRule ^(.*)index.html$ http://example.com/$1 [R=301,L]

but it doesn't work. Can you help me solve this problem?

© Pro Webmasters or respective owner

Related posts about htaccess

Related posts about redirects