i want to redirect all .html file in subdirtories into root directory with .htaccess file,it does not manner that how much directory is complicated or long.

example1: http://www.example.com/folder/folder2/folder3/folder4/main.html
to
http://www.example.com/main.html
example2
http://www.example.com/folder/manyfolder/main.html
to
http://www.example.com/main.html

Something like this:

RewriteRule ^(.*)/(.*?\.html)$ http://example.com/$2 [R=301,L]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.