站点 -》设置-》配置文件 里面进行设置
Nginx 1.21.1宝塔 tp5 Windows 环境下, 隐藏index.php 的配资文件
location / {
if (!-e KaTeX parse error: Expected '}', got 'EOF' at end of input: …{
rewrite ^(.*) /index.php?s=$1 last;
break;
}
}
Nginx 1.6.0宝塔 tp5 centeros 环境下, 隐藏index.php 的配资文件
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/?s=$1 last;
break;
}
}
Nginx 1.22 宝塔 tp5 windows 环境下, 隐藏index.php 的配资文件
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
win服务器下 隐藏了 index.php 后无法正常显示验证码 把$root 一行注释掉
\vendor\topthink\think-captcha\src\helper.php 里面找到 下面代码
function captcha_src($id = “”)
{
KaTeX parse error: Undefined control sequence: \think at position 7: root= \̲t̲h̲i̲n̲k̲\Url::root('/in…id ? “/{$id}” : ‘’));
}
不用配置 .htaccess 重写文件
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
本文介绍了在不同版本的Nginx(如1.21.1, 1.6.0和1.22)下,于宝塔面板中针对TP5框架隐藏index.php的配置方法。同时,针对Windows服务器环境下隐藏index.php后验证码无法正常显示的问题,提出了在`helper.php`文件中注释特定代码的解决策略。

772

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



