LoginSignup
0
0

More than 5 years have passed since last update.

WordpressのURLを変更したいとき(スラッグとか、、、)

Posted at

実際にやったのは、wordpress 4.1 と 4.1.1になります。
他のバージョンでやっていないので、その他のバージョンの人は詳しく見てください!

環境は
AWS の amazon Linuxです。

変更したい内容

例えば、 domain.com/aaaa/
ってのを、 aaaa.domain.com に変更する場合。

1)ドメインを変更する。

2)search-and-replace-for-wordpress-databasesをダウンロードする。

以下のものをダウンロードしてきて、Wordpressのトップディレクトリに導入する。
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

$wget https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

$unzip search-and-replace-for-wordpress-databases.zip

$mv search-and-replace-for-wordpress-databases /wpのトップフォルダ/

3)早速実行

にアクセスする。

勝手にwp-configとかの値を読んで、DB情報とかが入っていることを確認する。

search-replace-mobile-screenshot-320x1171.jpg

replaceに、以下のものを設定
domain.com/aaaa

withに以下のを設定
aaaa.domain.com

「dry run」 をクリックして、どんだけ書き換えられるのかをチェックする。
OKだったら、liveを押して実行する。

きっと数十秒で終わるはず、、、(件数にもよるが、、、)

その後、wpトップの .htaccessを書き換える。

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

#ここ重要です。
Search-Replace-DB-master ディレクトリを削除する。

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