Now, the post will always jump to another page, rather than to the position of post. My laravel version is 4.2. below is the test code. {Code...} and the above two configurations are as follows: both of them are post301 jump to another page, and the post page is normal. {Code...} Now,/post/will always jump to another page, instead of to/post.
My laravel version is 4.2. below is the test code.
php
Route::get('post', function() { return 'w/out slash'; });Route::get('post/', function() { return 'with slash'; });
php
Route::get('post/', function() { return 'with slash'; });Route::get('post', function() { return 'w/out slash'; });
The results of the above two configurations are as follows:/post/301 is redirected to another page, and the/post page is normal.
curl http://localhost/gitcafe/public/postwith slashcurl http://localhost/gitcafe/public/post/301 Moved PermanentlyMoved PermanentlyThe document has moved here.
Reply content:
Now,/post/always jumps to another page, instead of to/post.
My laravel version is 4.2. below is the test code.
php
Route::get('post', function() { return 'w/out slash'; });Route::get('post/', function() { return 'with slash'; });
php
Route::get('post/', function() { return 'with slash'; });Route::get('post', function() { return 'w/out slash'; });
The results of the above two configurations are as follows:/post/301 is redirected to another page, and the/post page is normal.
curl http://localhost/gitcafe/public/postwith slashcurl http://localhost/gitcafe/public/post/301 Moved PermanentlyMoved PermanentlyThe document has moved here.
Http://stackoverflow.com/questions/22063520/laravel-slash-after-url-re...
Yes? L5Route
The behavior of components is as follows:
- The same route is considered whether it has an ending slash or not;
- Jump to a non-diagonal line (at least
GET
So );
- When the same route is specified twice, the back side overwrites the front side.
The following are test cases and results:
Case 1
$ Diff my_l5_app/app/Http/routes. php l5_fresh/app/Http/routes. php22, 24d21 <Route: get ('Post/', function () {return' with slash ';}); <Route: get ('post ', function () {return 'w/out slash';}); $ curl http://test1.l5.invalid/post/here the Web server prompts 301 jump to login http://pastebin.com/ZMh0smvq$ curl http://test1.l5.invalid/postw/out slash
Case 2
$ Diff my_l5_app/app/Http/routes. php l5_fresh/app/Http/routes. php22, 24d21 <Route: get ('post', function () {return 'W/out slash ';}); <Route: get ('Post /', function () {return 'with slash';}); $ curl http://test1.l5.invalid/post/here the Web server prompts 301 jump to login http://pastebin.com/ZMh0smvq$ curl http://test1.l5.invalid/postwith slash
Because/post/AND/post are two route paths, you need to point them to one location and assign the configuration to both of them to the same location.
Laravel doesn't know, but I add other routes to the backend? Of
/Post /?