nginx
在vhost.conf中,添加
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
apache
下面是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>
说明:TP5官网教程中在.htaccess中的index.php后面没有?,需加上才能正常使用
网友评论