## 隐藏入口文件 Apache配置: 1. `httpd.conf`配置文件中加载了`mod_rewrite.so`模块 2. `AllowOverride None`将`None`改为`All` 3. 把下面的内容保存为`.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> ``` Nginx 伪静态配置: ``` location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } } ```