Route::get('{path}',"HomeController@index")->where( 'path', '([A-z\d-\/_.]+)?' ); not working
Closed this issue · 7 comments
Route::get('{path}',"HomeController@index")->where( 'path', '([A-z\d-/_.]+)?' ); not working when i refresh the page. i am using PHP 7.3.1
Can you show me your web.php code here ??
hello my super prof 🥇
when i try to access by just taping url like http://localhost:8000/drivers i go the same error
this is what it have in my web.php:
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
Route::get('invoice', function(){
return view('invoice');
});
Route::get('{path}',"HomeController@index")->where( 'path', '([A-z\d-/_.]+)?' );
Hi buddy,
Can you please show me your error please. ?
this is the error...
ErrorException (E_WARNING)
preg_match(): Compilation failed: invalid range in character class at offset 20
Try this Route::get('{path}','HomeController@index')->where( 'path', '([A-z\d-/_.]+)?' );
This will solve the problem with laravel ^6.2 :
Route::get('/{any}', 'HomeController@index')->where('any', '.*');
This will solve the problem with laravel ^7.*:
Route::get('/{any}', 'HomeController@index')->where('any', '.*');