zedsimple's avatar

Lumen route not working

Here is my route: $router->get('/{any:/^(?!(?:api*|auth*|images*)).*/}', 'HomeController@index'); I dont want it match any route start with api, auth, images. But when i try visit my site: http://mysite.com it's return Sorry, the page you are looking for could not be found. And i try visit site start with api, auth, images it's still can access. What happen with my route? I dont think my regexr is wrong

0 likes
2 replies
NickVahalik's avatar
  • I'm not sure you need the / at the beginning and end of your Regex.
  • the * on api|auth|images are likely not required. Just note that it will capture anything that starts with those words, so you might want to include a / after that group.
zedsimple's avatar

Yah actually i dont need the / at the beginning and end of my Regex. So u mean my route will become $router->get('{any:^(?!(?:api|auth|images)/).*}', 'HomeController@index'); ?

Please or to participate in this conversation.