Last active
February 24, 2017 06:58
-
-
Save kamiyn/7b20d7d3d518139216dab12641042c4e to your computer and use it in GitHub Desktop.
wordpress URL変更を伴うサイト移動をした時に使う php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
phprequire( dirname(__FILE__) . '/wp-load.php' ); | |
// $_SERVER["HTTPS"] は使わず | |
// localhost の場合は http, それ以外は https 固定にする | |
$useHttps = !preg_match("/^localhost/", $_SERVER["HTTP_HOST"]); | |
$site = ($useHttps ? "https://" : "http://") . $_SERVER["HTTP_HOST"]; | |
update_option('siteurl', $site); | |
update_option('home', $site ); | |
echo "move to " . $site; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SSLで運用しているサイト用 (localhost を除外しているのは開発環境では SSL 適用していないため)
https://移動先のサイト/wp-sitemove.php にアクセスすると、「移動先のサイト」を siteurl, home に設定するPHP