I'm a beginner for laravel an vuejs, when I am trying to refresh the page I got such error message, this is my code from web file :
Route::get('{path}',"HomeController@index")->where('path','(-a-z0-9_\s)');
Anyone with and idea?
I'm a beginner for laravel an vuejs, when I am trying to refresh the page I got such error message, this is my code from web file :
Route::get('{path}',"HomeController@index")->where('path','(-a-z0-9_\s)');
Anyone with and idea?
From looking at you Regular Expression, even it it compiled you probably won't find any URI that matches it, so you will get Laravel No Route exception.
You should probably use Brackets []
to setup the range of character and add the +
to match that range multiple times to make words or phrase. Use this Regex :
[-a-z0-9_\s]+
The Route codes :
Route::get('{path}',"HomeController@index")->where('path','[-a-z0-9_\s]+');
Or use Brackets inside the Parenthesis :
Route::get('{path}',"HomeController@index")->where('path','([-a-z0-9_\s]+)');
Use https://regex101.com/ to validate your string with Regex the next time
you just need to change your code like this
Route::get('{path}',"HomeController@index")->where('path','[-a-z0-9_\s]+');