Home > Article > Backend Development > laravel routing has query_string problem
Laravel 5.1/nginx
nginx site routing
<code> location / { try_files $uri $uri/ /index.php$query_string; }</code>
laravel routing settings:
<code> ... Route::get('/shops/search ' 'ShopsController@search '); ...</code>
Problems:
http://site.app/shops/search This is normal
http://site.app/shops/search?... A 404 error occurs, any parameter is 404
Please tell me how to set it up? The search page has many parameters, keyword is just one of them. The above use of a keyword is just an example, so I only plan to use it as a Query string for access
Laravel 5.1/nginx
nginx site routing
<code> location / { try_files $uri $uri/ /index.php$query_string; }</code>
laravel routing settings:
<code> ... Route::get('/shops/search ' 'ShopsController@search '); ...</code>
Problems:
http://site.app/shops/search This is normal
http://site.app/shops/search?... A 404 error occurs, any parameter is 404
Please tell me how to set it up? The search page has many parameters, keyword is just one of them. The above use of a keyword is just an example, so I only plan to use it as a Query string for access
location is written wrong. There is a missing ? symbol
The correct one is as follows:
<code>location /{ try_files $uri $uri/ /index.php?$query_string; }</code>