【问题标题】:Updating my .htaccess file using Yoast SEO plugin stopped my wordpress website使用 Yoast SEO 插件更新我的 .htaccess 文件停止了我的 wordpress 网站
【发布时间】:2018-04-05 23:00:54
【问题描述】:

我使用 Yoast SEO 插件在我的网站的 .htaccess 文件中插入了图像过期代码,导致整个网站显示内部服务器错误 500。

更新 .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

更新后的代码是:

 # 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

<If Modulemod_expires.c>
# Enable expirations
ExpiresActive On 
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 month"
# Javascript
ExpiresByType application/javascript "access plus 1 year"
</IfModule>
  1. 是由于没有在行中提供空间或使用两次造成的。
  2. .htaccess 文件未显示更新后的代码。
  3. 管理面板停止工作。
  4. 通过 ftp 面板更新并不能解决问题。
  5. 停用插件也不起作用。 我的网站是securedoc.org

【问题讨论】:

    标签: php wordpress apache .htaccess mod-rewrite


    【解决方案1】:

    具体的.htaccess 规则和Yoast 没有关系,那你怎么搞这两者的关系呢?但是您的 IF 命令中有一个错误。

    &lt;IfModule mod_expires.c&gt;

    你缺少一个空格。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-10
      相关资源
      最近更新 更多