I have a simple html website with over 50 html pages. From statistics-script I sometime see users on a page like xyz.html/ (which redirect to 404) instead of xyz.html. I know a simple way is to put a 301 redirect but there are too many pages. Can anyone suggest a way to redirect all incoming traffic to the links with forward slash '/' to the pages without forward slash? (traffic usually comes from social media)
like
abc.html/ to abc.html
xyz.html/ to xyz.html
.
.
.
so on
edit:
I only want to do this on a specific directory not the whole domain. For example only to www.example.com/section/
www.example.com/section/abc.html/ to www.example.com/section/abc.html
www.example.com/section/xyz.html/ to www.example.com/section/xyz.html
RewriteRule ^((.+)\.html)/$ http://<your-domain>/$1 [L,R=301]
Replace <your-domain> with the name of your domain (and folder if required). Response is based on the data given here mod_rewrite: remove trailing slash (only one!)