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?

WordPressが返すURLを指定する方法

Last updated at Posted at 2022-04-13

はじめに

リバースプロキシ環境下などの場合に,
WordPressがレスポンスするURLを変更したいことがあります.
備忘録として設定方法を残します.
※WordPressのデータベースはMySQLを使用することを前提としています.

方法

MySQLに入ります.

$ mysql -u root -p
mysql>

WordPressのデータベースを選択します.

mysql> use wordpress;

レスポンスしたいURLを2箇所に設定します.

mysql> update wp_options set option_value = "http://example.com/" where option_name = 'siteurl';

mysql> update wp_options set option_value = "http://example.com/" where option_name = 'home';

設定が反映されていることを確認します.

mysql> select * from wp_options where option_name = 'home';
+-----------+-------------+---------------------------------+----------+
| option_id | option_name | option_value                    | autoload |
+-----------+-------------+---------------------------------+----------+
|         2 | home        | http://example.com/             | yes      |
+-----------+-------------+---------------------------------+----------+
1 row in set (0.00 sec)

sql> select * from wp_options where option_name = 'siteurl';
+-----------+-------------+---------------------------------+----------+
| option_id | option_name | option_value                    | autoload |
+-----------+-------------+---------------------------------+----------+
|         2 | home        | http://example.com/             | yes      |
+-----------+-------------+---------------------------------+----------+
1 row in set (0.00 sec)

反映されているのを確認したら,一応phpなどのWordPress関連のミドルウェアを再起動しておくことをお勧めします.

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?