laravel routing has query_string problem

WBOY
Release: 2016-08-22 11:45:36
Original
1236 people have browsed it

Laravel 5.1/nginx

nginx site routing

<code>    location / {
        try_files $uri $uri/ /index.php$query_string;

    }</code>
Copy after login
Copy after login

laravel routing settings:

<code> ...
 Route::get('/shops/search ' 'ShopsController@search ');
...</code>
Copy after login
Copy after login

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>
Copy after login
Copy after login

laravel routing settings:

<code> ...
 Route::get('/shops/search ' 'ShopsController@search ');
...</code>
Copy after login
Copy after login

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!