【发布时间】:2019-11-07 16:58:21
【问题描述】:
这是一个加载的标题。 我将我的网站从 Apache 转移到了 Nginx,我正在学习 Nginx 以自己的方式做事的艰难方式。它不喜欢 htaccess 文件,忽略它们。这在运行 Wordpress 时会导致问题,因为据说 wordpress 喜欢使用 htaccess 文件而 nginx 不喜欢。为什么?我不知道。
无论如何,
通过将此代码放在 nginx.conf 文件中,我设法弄清楚如何从 404 的深渊中恢复网站
location / {
index index.php index.html;
if (!-e $request_filename)
{
rewrite ^/(.+)$ /index.php last;
}
}
但是。
虽然页面在 HTTP 上加载正常,但 HTTPS 仍然显示可怕的 404。为什么?我不知道。那么,有人知道下一步该怎么做吗?
【问题讨论】:
-
试试:
location / { try_files $uri $uri/ /index.php?$args; }
标签: wordpress nginx https http-status-code-404 nginx-config