Trailing slash redirect in .htaccess not working

URLs with a trailing slash are not redirecting to the non-slashed version. I see the .htaccess rule managing this:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]

But it doesn't seem to be taking effect. For example if I visit then it redirects to a 404:

The same thing happens locally in MAMP:

Statamic seems to be appending the server root before the URL when removing the trailing slash, which is causing the problem.

I recently updated to Statamic 1.9.1 and moved from a Media Temple DV to Grid server. Don't think this issue is related to server change because it's happening MAMP too.

Tip: you can find trailing slashes in Sublime Text by enabling regex search:


As quick fix, I've changed all links to internal URLs to not have trailing slashes. It'd be nice if the redirect worked though so other sites linking to slashed-URLs won't be dead. I'm already at my depth in Apache config though.

Answered by Brendan Falkowski!
>>>>>>> Answered <<<<<<<
8 Replies