.htaccess配置隐藏index.php

2017-04-23  本文已影响0人  孤岛渔夫
1. deny from all #apache
2. tp5默认 规则 #apache
<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
3.phpstudy 规则 #apache
<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>
4,nginx
配置 Nginx.conf 中添加:
loaction /{ //....省略部分代码
      if(!-e $request_filename){
              rewrite ^(.*)$ /index.php?s=/$1 last;
              break;
      }
}
#.htaccess
<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

上一篇 下一篇

猜你喜欢

热点阅读