久成视频在线观看免费-先锋影音资源影音中在线不卡-久久精品—区二区三区美女-久久国产免费一区二区三区

<track id="icesm"></track>

    1. 龍巖易富通網(wǎng)絡(luò)科技有限公司

      龍巖小程序開發(fā),龍巖分銷系統(tǒng)

      在nginx和apache下如何去除url中的index.php

      2015.10.01 | 2159閱讀 | 0條評論 | 服務(wù)器配置

      apache環(huán)境下:

      通過 .htaccess 文件來設(shè)置一些簡單的規(guī)則刪除它。

      <IfModule mod_rewrite.c> 

       Options +FollowSymlinks -Multiviews 

       RewriteEngine on 

       RewriteCond %{REQUEST_FILENAME} !-d 

       RewriteCond %{REQUEST_FILENAME} !-f 

       RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 

       RewriteRule /api/(.*)$ /api/index.php/$1 

       RewriteRule /sysadmin/(.*)$ /sysadmin/index.php/$1 

      </IfModule>

      如果你的項(xiàng)目不在根目錄請把上面這一句改為:RewriteRule ^(.*)$ index.php/$1 [L]

      在上面的例子中,可以實(shí)現(xiàn)任何非 index.php、images 和 robots.txt 的 HTTP 請求都被指向 index.php。


      Nginx環(huán)境下:

      修改nginx配置文件,在SERVER段中添加如下代碼:

      location / {   

       if (-f $request_filename) {      

                  expires max; 

                  break;     

        }     

        if (!-e $request_filename) {         

                  rewrite ^/(.*)$ /index.php?/$1 last;     

        } 

      }


      location /目錄/ {

          if (!-e $request_filename){

         rewrite ^/目錄/(.*)$ /目錄/index.php/$1 last;

          }

      }

      贊 (

      發(fā)表評論