I have tried almost all possible solutions for getting a trailing slash in my url but somehow it seems to conflict with the rest of my rules RewriteEngine On
I am trying to go from example.com/filename to example.com/filename/
### START WWW & HTTPS # ensure www. RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # ensure https RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] ### END WWW & HTTPS RewriteBase / RewriteRule ^([^.?]+[^.?/])$ $ 1/ [R=301,L] RewriteCond %{DOCUMENT_ROOT}/$ 1.php -f RewriteRule ^(.*[^/])/?$ /$ 1.php [QSA,L] RewriteRule ^index\.php$ / [R=301,L] #1)externally redirect "/file.php" to "/file" RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC] RewriteRule ^ /%1 [NC,L,R] #2)Internally map "/file" back to "/file.php" RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*?)/?$ /$ 1.php [NC,L]
Domainname.com/example still does not automatically go to domainname.com/example/ Is is driving me nuts!