【问题标题】:How to replace http:// urls with https:// - wordpress ssl如何用 https:// 替换 http:// 网址 - wordpress ssl
【发布时间】:2017-01-12 18:18:55
【问题描述】:

似乎是一个简单的问题,但由于我不擅长 MySQL,我不知道如何准确地实现这一点。

我想在 HTTPS:// 中推出我的 Wordpress 网站,因此我使用 Plesk Onyx(让我们加密)生成了一个 SSL 证书并将其添加到我的网站。但我现在必须将我数据库中的旧 (http://siteurl.com/index.php?site=foo) 等更改为 https://siteurl.com/index.php?site=foo

我知道有某事。就像 mysql 中的查找和替换命令,但我如何形成语句才能准确地将所有链接(超过 200 个)更改为 https://

【问题讨论】:

    标签: php mysql wordpress ssl


    【解决方案1】:

    我不确定 wordpress 表格的外观如何,但您的查询应该是这样的,但填写了正确的表格。

    UPDATE table SET column = replace(column, 'http://', 'https://') WHERE column NOT LIKE 'https://%';
    

    对于尚未更新的网址,这会将 http:// 替换为 https://。它只需要运行一次。

    【讨论】:

    • 我的表中有不正确的 url 被称为 Gp90g_posts 并且列是 guid 所以语句必须看起来像 UPDATE Gp90g_posts SET guid = replace(guid, 'http://', 'https://') WHERE guid NOT LIKE 'https://%';?
    猜你喜欢
    • 2019-05-20
    • 2018-12-15
    • 1970-01-01
    • 1970-01-01
    • 2012-02-28
    • 2019-05-17
    • 1970-01-01
    • 2018-01-06
    • 1970-01-01
    相关资源
    最近更新 更多