0
0

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 3 years have passed since last update.

(小ネタ)Wordpressのドメイン変更でサイトIDを変更する方法

Posted at

概要

サイト移転等でWordpressのドメインを変更する際の手順について。

mysqlの設定変更

サイトIDは管理画面から変更可能であるが、ドメインを変更した場合、サイトに接続できなくなるため、mysqlから設定の変更が必要となる。
*以下、テーブル名は設定に応じて、読み替えてください。

設定の確認

以下SQLで現状の'home','siteurl'の設定内容を確認できる。

SELECT * FROM wp_options WHERE option_name IN ('home','siteurl');

変更する方法

以下SQLで'home','siteurl'に新しいドメインを設定できる。

update wp_options SET option_value = " https://new.domain.com" where (option_id = 1  and option_name = "siteurl" ) OR (option_id = 2 and option_name = "home");

記事内のURLの修正

記事内にURLが埋め込まれている場合、そのURLも修正する必要がある。

記事のURLを確認する

以下SQLで記事内にURLが存在するかを確認できる。URLがあれば、修正する。

select * from wp_posts where guid like "https://old.domain.com/%" limit 10;
0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?