apache:
修改网站根目录的 .htaccess 文件 直接复制粘贴就可以
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
如果你的apache是fastcgi 模式 那就改成下面这样
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>
重启服务即可
Nginx:
修改 vhosts.conf 文件
修改 location 下
autoindex on;
在 autoindex on; 下面增加一段
# 伪静态配置
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
重启服务即可