【问题标题】:Wordpress website: .htaccess erasedWordpress 网站:.htaccess 已删除
【发布时间】:2015-05-27 21:51:35
【问题描述】:

我有一个使用 wordpress 4.2.2 制作的网站。有时我的 .htaccess 会被旧版本擦除,看起来像这样。

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

我在“RewriteRule ./index.php [L]”行下添加了许多 PermanentRedirect。只有这些线条消失了。

我已经看过herethere

没有任何插件与 .htaccess 交互,而且消失的不是整个内容。

我不知道这个问题的根源是什么。

编辑:似乎每次有人访问永久链接设置页面时,.htaccess 都会被擦除。

【问题讨论】:

  • 您在哪个平台上工作,哪个提供商正在为您提供托管服务?

标签: wordpress .htaccess mod-rewrite url-redirection


【解决方案1】:

WordPress 将# BEGIN WordPress# END WordPress 之间的任何内容视为它的“领土”。当需要更新时,它使用这些 cmets 来查找和替换自己的规则。

如果要添加自定义规则,则必须将它们添加到该块之外,以便 WordPress 不会覆盖它们。

【讨论】:

    【解决方案2】:

    抱歉没有更新。

    仍然不知道我的代码以前是如何被覆盖的,但是将我的规则放在 # BEGIN WordPress# END WordPress 注释行之外就可以了。

    【讨论】:

      猜你喜欢
      • 2011-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      相关资源
      最近更新 更多