Remove trailing slash using apache mod_rewrite Supporting tagline
Either I’m a poor googler or there are is no proper example on how construct a decent RewriteRule to remove trailing slash from URL’s in apache using mod_rewrite.
Anyho, here’s my recipe for just that.
RewriteRule ^(.+)/(\?.+)?$ $1$2 [R=301,L]
This captures two groups of characters with a “/” in between. The first group contains the base URL. The second groups is optional and contains eventual request parameters.