Redirection to Enforce Trailing Slash on URLs

If you need to enforce a trailing slash at the end of your URLs you can use the following helper plugin. Note that as long as your canonical URLs are correctly set, Google will index the desired URL even without this fix.

📥  Download (.zip): WP Rocket | Enforce Trailing Slash on URLs

Developers: You can find the code for this plugin on GitHub.

These are the rules that the above helper plugin adds to the .htaccess file:

# Force trailing slash
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]