隐藏index.php

1-设置application/config.php,config/app.php重写配置app_rewrite为true


2-配置重写规则


IIS 服务器环境

<rewrite>

<rules>

<rule name="OrgPage" stopProcessing="true">

<match url="^(.*)$" />

<conditions logicalGrouping="MatchAll">

<add input="{HTTP_HOST}" pattern="^(.*)$" />

<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />

<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />

</conditions>

<action type="Rewrite" url="index.php/{R:1}" />

</rule>

</rules>

</rewrite>

Apache 服务器环境


  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

 Nginx服务器环境


  location / { 
   if (!-e $request_filename) {
    rewrite  ^(.*)$  /index.php?s=/$1  last;
    }
}