tp3 除了首页,其他页面报错解决方案(nginx方案)

news/2024/7/24 14:31:23 标签: tp3

除了首页能访问,其他路由跳转都是Not Found,然后在域名后面加index.php就能访问,比如http://localhost:81/index.php/admin/,这样就能访问,去掉index.php就不行。

在这里插入图片描述
解决方法:
配置中隐藏掉index.php即可
打开nginx的配置文件

server {
        listen       81;
        server_name  www.gohosts.com gohosts.com;
        root   "F:\PHPTutorial\WWW\LvRenJiaJi";
        location / {
            index  index.html index.htm index.php;
            //加上这两句话
            if (-e $request_filename) {
              break;
            }
            if (!-e $request_filename) {
   				rewrite ^/(.*)$ /index.php/$1 last;
   				break;
   	    	}
   	    	
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
}

http://www.niftyadmin.cn/n/1301869.html

相关文章

一般前端登录表单提交校验方法

一般前端登录表单提交校验方法 html <form action"" method"post"><div class"inputItem flex"><p>手机号码&#xff1a;</p><input type"tel" placeholder"请输入手机号码" id"userPhon…

ssh连接的时候出现Host key verification failed.

今天在服务器上执行远程操作命令出现以下的问题: [rootwww ~]# ssh 205.209.161.** WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middl…

在APACHE服务器上的访问方式上去除index.php(伪静态)

在APACHE服务器上的访问方式上去除index.php 下面我说下 apache 下 &#xff0c;如何 去掉URL 里面的 index.php 例如: 你原来的路径是&#xff1a; localhost/index.php/index 改变后的路径是: localhost/index 1.httpd.conf配置文件中 #LoadModule rewrite_module modules/…

js模板替换,适用于ajax异步请求渲染数据

在你当前页面里&#xff0c;新建个js <script type"text/html" id"good_list"></script>注意type要是text/html&#xff0c;id的话&#xff0c;是你自定义id&#xff0c;待会给jq获取的 然后把你需要渲染的一段div放到中间 <script type&…

Apache 出现open_basedir restriction in effect

window服务器下&#xff0c;其他目录都会加上权限的&#xff0c;防止黑客入侵植入病毒文件&#xff0c;所以Apache上传服务器&#xff0c;临时文件需要保存到有权限的目录下&#xff0c;才能读写。 可以更改Apache下的php.ini配置文件&#xff0c;在目录D:\wamp\bin\apache\apa…

Centos 彻底卸载Mysql 再通过shell脚本一键安装

mysql卸载 首先查看yum方式 查看yum是否安装过mysql yum list installed mysql* 如或显示了列表&#xff0c;说明系统中有MySQL yum卸载 根据列表上的名字 yum remove mysql-community-client mysql-community-common mysql-community-libs mysql-community-libs-compat…

linux nginx服务器开启wss协议

1、先在linux找出nginx可执行文件的路径 命令行输入&#xff1a; ps -ef | grep nginx返回 [rootlocalhost /data/nginx/logs 09:47:00&&23]#ps -ef | grep nginx root 1734 1 0 Oct28 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/loca…

VUE 使用echarts线图,常用配置属性介绍

VUE 使用echarts线图&#xff0c;常用属性介绍 文章就是介绍应该会用得上的属性设置。这里不是安装教学哈&#xff0c;安装教学出门左转&#xff01; 介绍全在代码的备注中&#xff0c;请慢慢食用&#xff01; methods: {myEcharts() {var that this// 基于准备好的dom&…