Home > Backend Development > PHP Tutorial > laravel routing has query_string problem

laravel routing has query_string problem

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-22 11:45:36
Original
1332 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
Latest Issues
Composer cannot install laravel
From 1970-01-01 08:00:00
0
0
0
Laravel Space/laravel-backup cannot be installed
From 1970-01-01 08:00:00
0
0
0
Laravel 5.1 Login laravel comes with it No more
From 1970-01-01 08:00:00
0
0
0
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template