简体   繁体   中英

Laravel two routes with the same base pointing to different controllers?

I have /{country}/{city} and /{country}/{city}/{cat} pointing to two different controllers. However the second one keeps returning 404. It does not get directed to the method in the controller. Can I not use that base structure twice for different controllers? Seems pretty weird.

Thanks

Make sure that

/{country}/{city}/{cat}

is before

/{country}/{city}

in your routes.php. It will always look for the first matching ruleset.

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