亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

url 中傳遞參數的搜索結果頁面返回狀態 404

url 中傳遞參數的搜索結果頁面返回狀態 404

PHP
POPMUISE 2023-07-21 16:06:32
嘗試使用以下形式在我的 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我的搜索結果頁面上不再有


查看完整回答
反對 回復 2023-07-21
  • 1 回答
  • 0 關注
  • 136 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號