### \# 偽靜態
可以通過URL重寫隱藏應用的入口文件`index.php`,下面是相關服務器的配置參考:
## Nginx
在Nginx低版本中,是不支持PATHINFO的,但是可以通過在Nginx.conf中配置轉發規則實現:
~~~
location / { // …..省略部分代碼
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
~~~
## 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>
~~~