【问题标题】:403 response code with http but not with https on wordpress403响应代码与http但不是在wordpress上的https
【发布时间】:2019-07-01 15:59:35
【问题描述】:

我遇到了一个问题。我有一个 WordPress 网站,当我尝试使用 HTTP 访问它时,我得到了一个 403 HTTP 响应代码,但它适用于 https。 我已经认为这是一个重定向问题,所以我将此代码添加到我的 .htaccess

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

你有什么想法吗...我真的不明白它从哪里来...

谢谢

PS:

我的完整 .htaccess :

# BEGIN WordPress

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

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

# END WordPress

【问题讨论】:

  • 更新默认的 WordPress htaccess
  • 旁白:您应该修改# BEGIN WordPress 代码块中的代码。任何自定义重定向都应该在 之前 this.
  • 这种情况发生了多长时间?您有权访问服务器配置吗?

标签: wordpress .htaccess redirect https http-status-code-403


【解决方案1】:

在您的 htaccess 中更新此代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

试试这个让我知道我认为它适合你

【讨论】:

  • 不,它不工作......这是我的网站网址,如果你想看看它:工作:geneweb.eu 不工作:geneweb.eu(你如何在堆栈溢出的帖子中格式化代码?所以我可以把我完整的 .htaccess 发给你)
  • 我在帖子中添加了完整的 .htaccess
猜你喜欢
  • 2018-12-01
  • 1970-01-01
  • 2019-08-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-04
  • 2014-03-21
  • 1970-01-01
相关资源
最近更新 更多