我在 WordPress 网站上工作并添加了 SSL。现在我的主页有重定向问题。其余页面工作正常。目前,我无法登录管理面板。
我使用永久链接作为“邮寄名”。在数据库中,我已将站点和主页 URL 更改为“https://mysiteurl.com”。
请建议我需要进行哪些更改才能正确重定向我的主页。
最佳答案
请将此代码添加到您的 .htaccess 文件中:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
然后在您的 wp-config.php 的末尾添加这行代码:
define('FORCE_SSL_ADMIN', true);
更新
如果您使用 nginx,请将此包含在您的配置文件中:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
关于使用 SSL 的 WordPress 多站点主页重定向问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58777505/