wordpress - Wordpress HTTP 请求 501 内部服务器错误
问题描述
您好,我有 digitalocean 一键式应用程序包含 Wordpress。我将域添加到我的服务器并为我的服务器创建 SSL 证书。 https://example.com效果很好,但是当我请求 http://example.com时,它的重定向 - > http://myserverip.com并给出了该错误:
内部服务器错误
服务器遇到内部错误或配置错误,无法完成您的请求。
请通过 webmaster@localhost 联系服务器管理员,告知他们此错误发生的时间,以及您在此错误之前执行的操作。
服务器错误日志中可能提供有关此错误的更多信息。
此外,在尝试使用 ErrorDocument 处理请求时遇到了 301 Moved Permanently 错误。
请帮帮我。我尝试将 http 重定向到 https,但它不起作用!这是我的 .htaccess 文件包含:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
# 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
解决方案
试试这个,对我有用:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTPS} =off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]
</IfModule>
推荐阅读
- python - 在渲染页面上获取 404
- python - Django 错误(1054,“'字段列表'中的未知列'models_author.user'”)
- c# - 具有不变名称“MySql.Data.MySqlClient”的 ADO.NET 提供程序未在计算机或应用程序配置文件中注册
- iis - 在 IIS 10 中设置和读取环境变量
- node.js - Webpack - 你如何在 bundle (saslprep) 中需要一个可选的依赖项
- java - 使用 null 参数调用对任意对象的方法引用时出现 NullPointerException
- r - 是否可以将字体存储在 R-Package 中?
- android - 如何在多模块项目中配置 Flutter 模块
- android - 无法在 Google Play 商店上发布 Xamarin.Forms 应用程序的 APK 文件
- java - 足球比赛调度算法