Home  >  Article  >  Backend Development  >  laravel routing has query_string problem

laravel routing has query_string problem

WBOY
WBOYOriginal
2016-08-22 11:45:361279browse

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

Reply content:

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>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn