Laravel 4.1 removed redirectIfTrailingSlash as it can now be controlled in the .htaccess file (as it always should have been!).
You also might also want to change vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.phpso that generated URLs have a slash at the end of them.
public function to($path, $parameters = array(), $secure = null) {
// ...
return trim($root.'/'.trim($path.'/'.$tail, '/'), '/') . '/';
}
After changing this code, templates and code that use URL generators (such as URL::to()) will now generate URLs with a trailing slash at the end of the URL, which saves you an extra character in your templates!
EDIT: As timgws mentioned, this solution no longer works in Laravel 4.1+
If you comment out line 16 in bootstrap/start.php
https://github.com/laravel/laravel/blob/master/bootstrap/start.php#L16
It should no longer redirect to the URL without the slash.
Then you can redo your route to show the trailing slash like:
If you are using Laravel 4.0 (not 4.1), you should comment out line 16 in bootstrap/start.php (https://github.com/laravel/laravel/blob/master/bootstrap/start.php#L16)
Laravel 4.1 removed
redirectIfTrailingSlash
as it can now be controlled in the.htaccess
file (as it always should have been!).You also might also want to change
vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php
so that generated URLs have a slash at the end of them.After changing this code, templates and code that use URL generators (such as
URL::to()
) will now generate URLs with a trailing slash at the end of the URL, which saves you an extra character in your templates!