If you have a website, you should always use the forward slash at the end of all urls.
If for some reason you do not, then this code is very helpful.
To remove a slash at the end:
example: – https://www.codehaven.co.uk
RewriteCond %{HTTP_HOST} (.*)
RewriteCond %{REQUEST_URI} /$ [NC]
RewriteRule ^(.*)(/)$ $ 1 [L,R =301]
To add a slash to the end
example: – https://www.codehaven.co.uk/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]











