【问题标题】:.htaccess rules being ignored.htaccess 规则被忽略
【发布时间】:2023-03-25 04:57:01
【问题描述】:

我在.htaccess 文件中有以下内容。 SSL 重定向运行良好,但是当我到达 abc.html 时,我得到一个 404。test.html 页面存在并且如果我直接进入它就可以工作。

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^abc\.html$ /test.html [L]

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.org/$1 [R,L]

重写规则都按预期工作,之前的规则列表要长得多。在 cPanel 中更新主域后,他们停止工作并将其缩减为这个最小示例。

【问题讨论】:

  • abc.html 文件的完整 url 是什么?
  • 这是一个内部 DNS 记录,但在本例中为https://example.org/abc.html,测试文件位于https://example.org/test.html

标签: apache .htaccess cpanel


【解决方案1】:

在更新域时,cPanel 生成的httpd.conf 中似乎存在配置错误。强制 cPanel 重新生成 conf 文件解决了这个问题。

【讨论】: