課程
/后端開發(fā)
/PHP
/輕松學(xué)會Laravel-基礎(chǔ)篇
設(shè)置路由名就無法訪問,出現(xiàn)404錯誤
2018-07-21
源自:輕松學(xué)會Laravel-基礎(chǔ)篇 3-1
正在回答
在nginx里加上如下rewrite代碼:
location / {
? ? ? ? try_files $uri $uri/ /index.php?$query_string;
? ? }
? ? if (!-d $request_filename)
? ? {
? ? ? ? rewrite ^/(.+)/$ /$1 permanent;
? ? # 去除index action
? ? if ($request_uri ~* index/?$)
? ? ? ? rewrite ^/(.*)/index/?$ /$1 permanent;
? ? # 根據(jù)laravel規(guī)則進行url重寫
? ? ? if (!-e $request_filename)
? ? ? {
? ? ? ? ? rewrite ^/(.*)$ /index.php?/$1 last;
? ? ? ? ? break;
? ? ? }
? ? ? #error_page ? 500 502 503 504 ?/50x.html;
? ? ? location = /50x.html {
? ? ? ? ? root ? html;
舉報
Laravel框架基礎(chǔ)視頻教程,輕松入門,了解Laravel的優(yōu)勢
1 回答wnmp配置laravel,路由訪問出錯。
2 回答路由訪問不了
1 回答路由別名的問題
3 回答路由的別名
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2018-07-23
在nginx里加上如下rewrite代碼:
location / {
? ? ? ? try_files $uri $uri/ /index.php?$query_string;
? ? }
? ? if (!-d $request_filename)
? ? {
? ? ? ? rewrite ^/(.+)/$ /$1 permanent;
? ? }
? ? # 去除index action
? ? if ($request_uri ~* index/?$)
? ? {
? ? ? ? rewrite ^/(.*)/index/?$ /$1 permanent;
? ? }
? ? # 根據(jù)laravel規(guī)則進行url重寫
? ? ? if (!-e $request_filename)
? ? ? {
? ? ? ? ? rewrite ^/(.*)$ /index.php?/$1 last;
? ? ? ? ? break;
? ? ? }
? ? ? #error_page ? 500 502 503 504 ?/50x.html;
? ? ? location = /50x.html {
? ? ? ? ? root ? html;
? ? ? }