美文网首页
.htaccess配置隐藏index.php

.htaccess配置隐藏index.php

作者: 孤岛渔夫 | 来源:发表于2017-04-23 12:20 被阅读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>

相关文章

网友评论

      本文标题:.htaccess配置隐藏index.php

      本文链接:https://www.haomeiwen.com/subject/dhtyzttx.html