Append trailing slash to url in Laravel 4

后端 未结 2 1058
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-20 04:20

Simple question, but I can\'t find any answer that works:

How to append trailing slash to url in Laravel 4?

2条回答
  •  不知归路
    2021-01-20 04:48

    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

    //$app->redirectIfTrailingSlash();
    

    It should no longer redirect to the URL without the slash.

    Then you can redo your route to show the trailing slash like:

    Route::get('login/', function() { // etc
    

提交回复
热议问题