简体   繁体   中英

Laravel taking url string as parameter

So basically i want to create a route like http://example.com/{page_slug} on my laravel app, but when i register that in my routes file it affects pages like http://example.com/login as it give me an error related to page "login" not found.

Here is my route with the page slug parameter

Route::get('/{slug}','Admin\PageController@viewPage');

The login route id generated automatically, i'm using laravel 5.4

Any help is appreciated

I found the solution:

All i had to do was put the

Route::get('/{slug}','Admin\PageController@viewPage');

As the last route, so other routes would be checked first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM