0

Is it possible to redirect a url without trailing slash to the URLs with trailing slash in Kirby CMS? How?

From

http://www.test.com/page

To

http://www.test.com/page/

htaccess file

<IfModule mod_rewrite.c>
DirectorySlash On
RewriteEngine on
RewriteBase /test/kirby/
RewriteRule ^content/(.*)\.(txt|md|mdown)$ error [R=301,L]
RewriteRule ^site/(.*) error [R=301,L]
RewriteRule ^kirby/(.*) error [R=301,L]
RewriteRule ^robots.txt robots.txt [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
</IfModule>
Jens Törnell
  • 23,180
  • 45
  • 124
  • 206

2 Answers2

0

How about this

    RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
Anthony
  • 801
  • 10
  • 20
  • Did not work. I don't know if it has to do with that I'm working on localhost? http://127.0.0.1:8080/test/kirby/projects work but does not get redirected. – Jens Törnell Mar 11 '14 at 10:13
0

Finally I found it, works on localhost as well.

RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]

http://www.paulund.co.uk/using-htaccess-to-force-trailing-slash

Jens Törnell
  • 23,180
  • 45
  • 124
  • 206