嘗試使用以下形式在我的 Laravel 網站上實現簡單的搜索:<form action="https://www.example.com/search-results" class="cse-search-box"> <input type="hidden" name="cx" value="partner-pub-mygoogleid:myid"> <input type="hidden" name="cof" value="FORID:10"> <input type="hidden" name="ie" value="UTF-8"> <input type="text" class="search-inp icon" name="q" size="30" placeholder="Search my site"> </form>該表單生成的 url 為:https://www.examlle.com/search-results?cx=partner-pub-mygoogleid%myid&cof=FORID%3A10&ie=UTF-8&q=searchterm`我的路線是:Route::get('search-results', 'SearchController@getResults');一切似乎都有效,除了一件非常有趣的事情,搜索結果頁面顯示狀態 404。當我從 url 中刪除參數時,狀態會更改為 200。知道為什么會發生這種情況,或者有什么建議如何實現此表單,以便在存在參數時其響應為 200?
1 回答

www說
TA貢獻1775條經驗 獲得超8個贊
我發現問題出在我的nginx.conf
問題出在該行的 location php 塊內try_files $query_string/index.php =404;
location ~ \.php$ {
# try_files $query_string/index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
注釋掉后,一切都按預期進行,status 404我的搜索結果頁面上不再有
- 1 回答
- 0 關注
- 136 瀏覽
添加回答
舉報
0/150
提交
取消