Search code examples
apache.htaccessbolt-cmstrailing-slash

Bolt trailing slash


im using bolt for a little time now and have never done anything with htacces files before. my question in this tread is, how do i put a trailing slash in a url generated by bolt. i was trying stuff out and looking things up on how to do this. but i only came by a piece of code that puts the / behind the url only then it gets in a loop adding and removing the /.

   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_URI} !=/favicon.ico
   #------addition-------#
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*[^/])$ /$1/ [L,R=301]
   #---------------------#
   RewriteCond %{REQUEST_FILENAME} -f
   RewriteRule ^ - [L]

the code in the addition area is my add / addition. and i presume the code unther that gets rid of the / becouse when i run it without that it says link/ in the console but the problem at that point is. i get an apache 500 error. and the link/ in the console is red.

is there something in bolt or appache that i need to edit to to let this work. or am i doing this completely wrong. i hope to get your expertise on this becouse i have this problem for +-5 hours now.

if it helps this is the complete file:

RewriteEngine on
 RewriteRule cache/ - [F]
 RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
 RewriteRule ^(.*) - [E=BASE:%1]

 RewriteCond %{HTTP:Authorization} .
 RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

 RewriteCond %{ENV:REDIRECT_STATUS} ^$
 RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1/ [L,R=301]

 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_URI} !=/favicon.ico
 #------addition-------#
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*[^/])$ /$1/ [L,R=301]

 #------original--------#
 RewriteCond %{REQUEST_FILENAME} -f
 RewriteRule ^ - [L]


 #-------using the base file for routing--------#
 RewriteRule ^ %{ENV:BASE}/index.php [L]

Solution

  • Bolt uses Silex under the hod, you might want to red what Fabien has to say on this before investing too much more time