the following rule will match any URL ending in a slash and remove all slashes from the end of it:
RewriteRule ^(.*)/+$ $1 [R=301,L]
Note: The currently accepted answer only works for http not https but this one works for both.
More Related Contents:
- htaccess redirect to https://www
- How to redirect URLs based on query string?
- CSS, JS and images do not display with pretty url
- mod_rewrite: remove query string from URL?
- RewriteCond to match query string parameters in any order
- htaccess RewriteRule page with query string
- The Redirection of Multiple Parked Domains doesn’t Work with Filename [closed]
- Reference: mod_rewrite, URL rewriting and “pretty links” explained
- Remove .php extension with .htaccess
- Tips for debugging .htaccess rewrite rules
- apache redirect from non www to www
- htaccess remove index.php from url
- Hidden features of mod_rewrite
- What does RewriteBase do and how to use it?
- How to debug .htaccess RewriteRule not working
- Forbidden You don’t have permission to access / on this server [closed]
- how to remove folder name from url using htaccess
- .htaccess rewrite query string as path
- apache redirect http to https and www to non www
- .htaccess rewrite “/book.php?id=1234” to “/book/1234”
- htaccess redirect all pages to single page
- mod_rewrite with anchor link
- Remove Characters from URL with htaccess
- 301 Redirect to replace all spaces to hyphens
- Redirect requests only if the file is not found?
- Multiple RewriteRules for single RewriteCond in .htaccess
- Rewrite Problem – L(ast) not being respected?
- Difference between $1 vs %1 in .htaccess
- How can I mod_rewrite and keep query strings?
- AH10411 error: Managing spaces and %20 in apache mod_rewrite