第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

nginx重寫:如果$uri 不是文件不是目錄 跳轉(zhuǎn)到$uri/

nginx重寫:如果$uri 不是文件不是目錄 跳轉(zhuǎn)到$uri/

Qyouu 2019-04-16 20:26:24
配置nginx1.6.2要求訪問$uri如果1)如果存在文件/Vhost/$http_host/$uri,訪問的是該文件2)否則如果$uri不是以“/”結(jié)尾301跳轉(zhuǎn)到$uri/3)否則如果$uri以“/”結(jié)尾且存在/Cache/$http_host/$uri/index.html,訪問的是該文件4)否則指向/index.php(ThinkPHP框架)例子訪問http://www.a.com/robots.txt->/Vhost/www.a.com/robots.txt訪問http://a.com/robots.txt->301跳轉(zhuǎn)->http://www.a.com/robots.txt訪問http://www.c.com/sitemap.html->/Vhost/www.c.com/sitemap.html訪問http://www.d.com/game/->/Cache/www.d.com/game/index.html訪問http://www.d.com/news/1000011->301跳轉(zhuǎn)到->http://www.d.com/news/1000011/訪問http://www.d.com/news/1000011/->/index.php(當(dāng)該/Cache/www.d.com/news/1000011/index.html不存在的時候)訪問http://www.d.com/news/1000011/->/Cache/www.d.com/news/100011/index.html(當(dāng)該/Cache/www.d.com/news/1000011/index.html存在的時候)配置server{listen80;server_namewapwap.locm.wap.locwap.locm.xxx.comgame1.wap.locgame2.wap.locgame3.wap.loc;location/{rootd:/wap_dev;indexindex.htmlindex.htmindex.php;try_files$uri/Vhost/$http_host/$uri/Cache/$http_host/$uri/index.html/index.php?s=$uri&$args;location~\.php${try_files$uri=404;fastcgi_pass127.0.0.1:9000;fastcgi_indexindex.php;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;includefastcgi_params;}}#error_page404/404.html;#redirectservererrorpagestothestaticpage/50x.html#error_page500502503504/50x.html;location=/50x.html{roothtml;}location~/\.(ht|svn|git){denyall;}}問題已經(jīng)實現(xiàn)了上面的1、3、4,還有2未實現(xiàn)。上面第3)點打錯字了,是如下的。已經(jīng)修改了的,但是sg沒有變化3)否則如果$uri以“/”結(jié)尾且存在/Cache/$http_host/$uri/index.html,訪問的是該文件補(bǔ)充1)如何才可以不是以/結(jié)尾且不是以.xml結(jié)尾且不是以.html.htm結(jié)尾的才跳轉(zhuǎn)現(xiàn)在是不是以/結(jié)尾的跳轉(zhuǎn),導(dǎo)致.xml結(jié)尾.html結(jié)尾的也都跳轉(zhuǎn)自己寫了一段,但是失?。簉ewrite([^\/]|\.xml|\.html?)$$uri/permanent;
查看完整描述

2 回答

?
慕運維8079593

TA貢獻(xiàn)1876條經(jīng)驗 獲得超5個贊

你需要使用一個@開頭的namedlocation來解決這個問題。
#如果找不到任何匹配的文件就會進(jìn)入@rewritelocation來決定如何rewrite
try_files$uri/Vhost/$http_host/$uri/Cache/$http_host/$uri/index.html@rewrite;
location@rewrite{
#如果末尾不是/,301跳轉(zhuǎn)
rewrite[^\/]$$uri/permanent;
#默認(rèn)交給index.php來處理
rewrite./index.php?s=$uri&$argslast;
}
                            
查看完整回答
反對 回復(fù) 2019-04-16
  • 2 回答
  • 0 關(guān)注
  • 308 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號