后台是php代码,入口文件是index.php。 为了提高百度seo,
需要将全部的www.localhost.com/index.php 重定向到 www.localhost.com。
nginx这边改不成功了。求答案
具体点就是,浏览器直接输入www.localhost.com/index.php, 点击请求之后,链接301了,浏览器上就变成www.localhost.com了。
想要的是这个效果。
我搜的好多都是判断index.php文件是否存在,不存在的时候,跳转。我的问题是index.php是存在的。但是不想页面上看到
在location中添加默认文件“ index index.php”类似修改成如下样式:
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}