301 redirect mod_rewrite to strip /index.html, will this snippet work?

I want any request that goes to mysite.com/index.html to be 301 redirected to mysite.com

Will the following mod_rewrite work in my htaccess file, is it comprehensive enough, and where would it need to be placed in the file?

RewriteCond %mysite.com/index.html HTTP [NC]
RewriteRule (.*)index.html$ /$1 [R=301,L]
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Johnson, CDRetiredCommented:
mysite.com will load the default document which is probably index.html
if you want to change it in your httpd.conf i.e.
DirectoryIndex home.php
BobbyAuthor Commented:

I dont understand. Are you saying that what i posted will not do what i said we need to do?
David Johnson, CDRetiredCommented:
if index.html is your default page then
http://mysite.com and http://mysite.com/index.html is exactly the same as the web server when given http://mysite.com will load the default document if it exists.

What page do you want the web server to load?
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
Likely what you're looking for is something like this...

RewriteCond %{THE_REQUEST} ^.*/index.html 
RewriteRule ^(.*)index.php$ http://www.domain.com/$1 [R=301,L] 

Open in new window

BobbyAuthor Commented:
This is for SEO reasons... I know the server will already do that but we want results displayed without the /index.html and this may help with that.

David F, that looks exactly like where I got this:

RewriteCond %mysite.com/index.html HTTP [NC]
RewriteRule (.*)index.html$ /$1 [R=301,L]

You think that will do it? Do you know where in the htaccess file it needs to go? Im not even sure how you test something like this.
BobbyAuthor Commented:
Ended up doing this, seems to work well:

RewriteRule ^index.html$ / [L,R=301]

Thanks all for the tips.
BobbyAuthor Commented:
RewriteRule ^index.html$ / [L,R=301]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.