一个网站建设爱好者,技术交流,相互学习
当前位置:首页>>程序猿
ThinkPHP 部署到nginx或者apache服务器上index.php隐藏等问题
发布时间:2021-11-15 11:17:04 栏目:程序猿 阅读量:1464 作者:webcms

ThinkPHP5项目部署到nginx服务器上,的常见问题:

1、pathinfo问题

开启pathinfo功能,修改站点配置文件

include enable-php.conf;
#换成
include enable-php-pathinfo.conf;

2、入口文件隐藏问题

修改站点配置文件

location / {
          if (!-e $request_filename) {
                rewrite ^(.*)$ /index.php?s=$1 last;
                break;
          }
       }

3.apache服务器

把下面的内容保存为.htaccess文件放到应用入口文件的同级目录下


Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]

4. IIS 隐藏index.php

<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>

完事了


评论:

IT视频教程
Copyright © web小工匠 保留所有权利. 渝ICP备15008469号 网站地图