使用phpstudy环境,运行tp框架的网站总是要输index.php,换个php环境就没问题了,是phpstudy的问题?
Apache解决方法:
composer安装thinkPHP的public中原来.htaccess文件的
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
改为
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
Nginx解决方法:
在Nginx.conf 的server{}中添加
server {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
重写生效,访问模块方法再也不用输入index.php了