Skip to content

Instantly share code, notes, and snippets.

Last active Feb 1, 2022
What would you like to do?
Local by Flywheel でインストールしたWordPresssをサブディレクトリに移動する
if [ "$1" = "" ]
echo "please set sub dir name"
exit 1
echo "move your wp to $1!"
OLD_WP_URL=`wp option get home --allow-root`
echo "old wp url is...$OLD_WP_URL"
echo "new wp url is...$NEW_WP_URL"
echo "new wp dir is...$NEW_WP_DIR"
echo "[wp search-replace] start"
wp search-replace $OLD_WP_URL $NEW_WP_URL --allow-root --path=/app/public
echo "[wp search-replace] end"
echo "[move wp files to new dir] start"
mkdir -p $NEW_WP_DIR
mv /app/public/* $NEW_WP_DIR
echo "[move wp files to new dir] end"
echo "[change confs] start"
cp -f /etc/nginx/includes/wordpress.conf /etc/nginx/includes/wordpress.conf.bk
cp -f ~/.bashrc ~/.bashrc.bk
source ~/.bashrc
sed -i -e "s#index.php#$1/index.php#g" /etc/nginx/includes/wordpress.conf
sed -i -e "s#wp --allow-root#wp --allow-root --path=$NEW_WP_DIR#g" ~/.bashrc
echo "[change confs] end"
echo "done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment