开启Apache的Rewrite功能:
1. httpd.conf
LoadModule rewrite_module modules/mod_rewrite.so
2. httpd.conf
<Directory "">
...
AllowOverride All
...
</Directory>
3. Web根目录下新建.htaccess文件,参考如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ ?s=/$1 [QSA,PT,L]
</IfModule>