nginx重写(隐藏)index.php目录

访问某域名时,去掉index.php目录时达到效果一样

如:   

  www.test1/index.php/test2跟www.test1/test2效果一致

  nginx配置中加入如下内容:

  location / {   

    if (!-e $request_filename) {   

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

break;   

  }

}

猜你喜欢

转载自www.cnblogs.com/wangguod/p/9905515.html