nginx去掉url中的index.php


使用情境:我想輸入www.abc.com/a/1后,實際上是跳轉到www.abc.com/index.php/a/1


配置Nginx.conf在你的虛擬主機下添加:
location / {
     if (!-e $request_filename){
          rewrite ^/(.*)$ /index.php/$1 last;
     }
}


如果你的項目入口文件在一個子目錄內,則:
location /目錄/ {
     if (!-e $request_filename){
          rewrite ^/目錄/(.*)$ /目錄/index.php/$1 last;
     }
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM