How to migrate WordPress to https (v-migrate-site-to-https)

Post Reply
Posts: 5
Joined: Sun May 30, 2021 3:49 am
How to migrate WordPress to https (v-migrate-site-to-https)

Post by XerxeS »

hi all
i have a simple issue. :D

eg. i have a site where letsencrypt works fine (SSL is active)
however on letsencrypt does not work (SSL not active)
within the subfolder wordpress is intalled.
how do i get letsencrypt to provide SSL for a subfolder ?



User avatar
Site Admin
Posts: 462
Joined: Fri Jun 19, 2020 9:59 am

Post by dpeca »

SSL is active for sure, but your wordpress has 'http://' URL in it's database (instead of 'https://').
We have command v-migrate-site-to-https:
You can call it from SSH:

Code: Select all

sudo /usr/local/vesta/bin/v-migrate-site-to-https
and it will automatically replace to in your WordPress database.

That's it !


...but, if your WordPress is uploaded in subfolder, our script will not detect WordPress in subfolder.

However, you can do http to https replace manually, with wp-cli:

Code: Select all

sudo wget -nv -O /usr/local/bin/wp
sudo chmod +x /usr/local/bin/wp

USER='' # enter here hosting username
DOMAIN='' # enter here domain, without http://, https:// and without www.
alias php='php7.3' # change to desired php version

cd /home/$USER/web/$DOMAIN/public_html/

sudo -H -u$USER wp search-replace "http://$DOMAIN" "https://$DOMAIN" --precise --all-tables --skip-columns=guid
sudo -H -u$USER wp search-replace "http://www.$DOMAIN" "https://www.$DOMAIN" --precise --all-tables --skip-columns=guid
sudo -H -u$USER wp cache flush
service memcached restart

grep -rl "http://$DOMAIN" ./ | xargs sed -i "s#http://$DOMAIN#https://$DOMAIN#g"
grep -rl "http://www.$DOMAIN" ./ | xargs sed -i "s#http://www.$DOMAIN#https://www.$DOMAIN#g"

Post Reply