gpt4 book ai didi

wordpress - 使用 htaccess 的 http 到 https 留下没有下拉菜单的站点菜单

转载 作者:可可西里 更新时间:2023-11-01 16:43:47 25 4
gpt4 key购买 nike

我已将 SSL 证书添加到我在 WordPress 上的网站。当我将以下代码添加到 htaccess 文件时,我在导航菜单中丢失了下拉菜单,并且在不同的浏览器中发生了不同的事情。

这是我添加到 htacces 中以强制站点从 http 到 https 的代码:

RewriteCond %{HTTPS} !=on

RewriteRule ^.*$ https://{SERVER_NAME}%{REQUEST_URI} [R,L]

现在的 htaccess 文件是这样的:

    # BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

如能帮助我恢复网站顶部的菜单导航,我将不胜感激。

最佳答案

WordPress 中的许多区域都创建指向内容和引用的链接(独立于站点)

<a href="/mypage">like this</a>

然而,代码中的其他地方是站点特定的,并引用了完整的 URL。如果您上传图片(例如),它将被引用在 http://www.example.com/wp-content/uploads/2013/03/image1.jpg

如果您在数据库表中搜索 http://www.example.com/并用/替换它,这将使您的所有引用都是相对的,并且 http/https 问题应该会消失。之前一定要备份你的数据库

另请注意,这将解决在 Internet Explorer 中收到如下警告的问题:

This page contains both secure and nonsecure items. Do you want to display the nonsecure items?

希望对你有帮助

关于wordpress - 使用 htaccess 的 http 到 https 留下没有下拉菜单的站点菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15307149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com