简体   繁体   English

对 .htaccess 文件的更改不断使我的 Wordpress 站点崩溃

[英]Changes to .htaccess file keep crashing my Wordpress site

A while ago, I started having a problem where every few days, my Wordpress site would crash.不久前,我开始遇到一个问题,每隔几天,我的 Wordpress 站点就会崩溃。 Instead of loading, the site would just download the contents of index.php.该站点不会加载,而是只下载 index.php 的内容。

After some investigation, I found that commenting out the following line in the .htaccess file solved the issue:经过一番调查,我发现在 .htaccess 文件中注释掉以下行解决了这个问题:

AddHandler application/php-70 .php

However, my comment on that line keeps getting over-written somehow.但是,我对那条线的评论总是以某种方式被覆盖。

So here are my questions:所以这是我的问题:

  • Why is that line causing the issue, and can the root cause be addressed?为什么该行会导致问题,并且可以解决根本原因吗?
  • If the root cause can't be addressed, how can I prevent my comment on that line from being overwritten?如果无法解决根本原因,如何防止我对该行的评论被覆盖?
  • If I can't prevent the comment from being overwritten, can I add some sort of monitoring to show my what's causing changes to the .htaccess file?如果我不能阻止评论被覆盖,我可以添加某种监控来显示导致 .htaccess 文件更改的原因吗?

Additional info: Wordpress 5.4.2 on SiteGround hosting附加信息:SiteGround 托管上的 Wordpress 5.4.2

Seems like some plugin is overwriting your changes in .htaccess, check this link https://wordpress.org/support/topic/php-version-change-can-break-htaccess which addresses a similar problem.似乎某些插件正在覆盖您在 .htaccess 中的更改,请查看此链接https://wordpress.org/support/topic/php-version-change-can-break-htaccess ,它解决了类似的问题。

Also, you can follow the instructions here https://www.siteground.com/kb/how_to_have_different_php_versions/ and you should (if you can) change/upgrade your php version to the required version.此外,您可以按照https://www.siteground.com/kb/how_to_have_different_php_versions/此处的说明进行操作,并且您应该(如果可以)将 php 版本更改/升级到所需版本。

Alternately, you can chmod 655 .htaccess file to disable any plugins writing to it.或者,您可以chmod 655 .htaccess文件来禁用任何写入它的插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM