近日选用phpstudy nginx 测试本地项目,thinkphp5.1 url('index/login/login')生成路径访问时不包含index.php,结果报404错误。
必须index.php/login/login这样访问 很丑
在对应的nginx 的域名配置文件中添加如下代码
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
下面以TP5的小程序网站为例子,去除index.php 的对应nginx配置:
选择小皮的 【设置】-》文件位置-》【NGINX】-》进入到了nginx的对应的配置文件位置:D:\phpstudy_pro\Extensions\Nginx1.15.11\

依次进入【conf】-》【vhosts】-》【xcx.dev.com_80.conf】




近日使用phpstudy nginx测试本地ThinkPHP5.1项目时,url生成路径访问不包含index.php会报404错误,需index.php/login/login这样访问。文章给出在nginx域名配置文件中添加代码以去除index.php的方法,并以TP5小程序网站为例说明配置文件位置。
3978

被折叠的 条评论
为什么被折叠?



