3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Wordpressのhttps化をDB直接変更で強引に行う

3
Posted at

Wordpressをhttps化したものの、一部ページ内の画像がhttpのままのため、ブラウザのアドレスバーに警告が出ていました。

1ページずつ修正するのは論外だし、プラグインを使うのも後々トラブルになりそうだったので、DBを直接弄って解決しました。


UPDATE wp_options SET option_value = replace(option_value, 'http://ドメイン', 'https://ドメイン') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'http://ドメイン', 'https://ドメイン');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://ドメイン','https://ドメイン');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'http://ドメイン','https://ドメイン');
UPDATE wp_links SET link_url = replace(link_url, 'http://ドメイン','https://ドメイン');
UPDATE wp_comments SET comment_content = replace(comment_content , 'http://ドメイン','https://ドメイン');
UPDATE wp_posts SET post_content = replace(post_content, 'http://ドメイン', 'https://ドメイン');
UPDATE wp_links SET link_image = replace(link_image, 'http://ドメイン','https://ドメイン');
UPDATE wp_posts SET guid = replace(guid, 'http://ドメイン','https://ドメイン');
3
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?