4
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の対応

Last updated at Posted at 2017-12-01

EC2再起動したら、wordpressにアクセスできなかった。

原因:WordPressではサイトURLをDBに保存し、このURLが変更になってしまった場合、このDBの値を変更しないことです。

案1:DBの値修正(非推奨)
原因:wp_posts テーブル中にも 旧IPアドレスが含まれたリンクが残っている。

select * from wp_options where option_name = 'siteurl';
select * from wp_options where option_name = 'home';

UPDATE wp_options SET option_value='http://xxx.xxx.xxx.xxx/wordpress' where option_name = 'siteurl';
UPDATE wp_options SET option_value='http://xxx.xxx.xxx.xxx/wordpress' where option_name = 'home';

1.jpg

案2:wp-cli利用して、すべての旧urlも書き換えます。

参照文章:
https://www.agilegroup.co.jp/technote/wordpress-site-change.html

4
1
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
4
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?