In my website, I'd like to redirect all pages with a trailing slash to the URL without trailing slash. I'm trying to find the right code that will actually work, and I have tried numerous versions of htacess codes that are supposed to to achieve redirect. I have read many articles about this issue and tested many possible solutions. Still haven't found an actual solution though.
Here's an example
RewriteEngine on
RewriteCond %{request_method} ^GET$
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)$ %1 [L,NE,R=301]
No redirect it happening here.
Is there something else that would affect redirection? Something I might be missing? Do you have any suggestions?
-----------------------------------------------------------
SOLUTION
The solution to this was to place the code AT THE TOP OF THE HTACCESS FILE. I was always placing it at the end of the file