How to force trailing slash?

In .htaccess add your code for forcing trailing slashes right after the “make panel links work” code.

Find:

# make panel links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]

After add the following, or whatever code you have for trailing slashes:

# redirect to trailing shash (/)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301]

Keep in mind that you should also add the trailing slash in the internal links of your website since the kirby functions such as url() do not include a trailing slash. If you don’t do that then a redirect will happen every time somebody clicks a link from one page to another (which will not be noticeable by the users, but it is not a good practice)