WordPress: Move Blog to new URL Domain HTTP HTTPS on the MYSQL Console

Info: Today most Search Engines prefer Blogs who are offering „HTTPS“ at the URL for secure direct connects to the Websites but this results a lot of headaches to the Website Developers.

To be effective you should know:

  • You have to offer HTTPS beside HTTP
  • You should use a validated Domain Certificate, most Domain Resellers offer them for FREE
  • You should know that NOT every FREE Certificate is TRUSTED by every Browser (green closed lock symbol at the adressbar)
  • You have to Develop Websites WITH variable Format output ( PC, Tablet, Smartphone, Smart-TV, Infoboxes,)
  • Design Websites and test 3:2, 4:3, 16:9, 21:9, Formats
  • Easy readable for handicapted People
  • Easy to print to PDF (Test Print Preview Page)
  • Test with different Browsers ( IE, Firefox, Midori, Chrome, Safari, Mobile Browsers like Webview, Silk) if you have no possibilities ask Friends to test

To move the Blog you must access the MySQL Server and the Blog Database! phpMyAdmin Admin Interface should NOT be used if you can use the Terminal for higher Security! If not access the phpMyAdmin Admin Weblogin only be Local IP!!!

MySQL Server:

  • Always remove Anonymous User!
  • Always replace the root User Account with a new one
  • Always use very long Database Passwords! minimum 12 digits !
  • Set if you can the Listen IP to localhost or Socket for the MYSQL Server, no one should be able to access the server via public IP. If you have a virtual Server without second IP install a Firewall like „ufw“ and block all Ports without 25, 80, 443!!

Database Changes:

  • Login to the Server via SSH and connect to the MySQL Server with $mysql -u databaseadmin -p
  • Enter following MySQL Commands:

 

mysql > use blogdatabasename;  #change to the blog database

mysql > UPDATE wp_posts SET guid = replace(guid, 'http://www.domain','https://www.domain');

mysql > UPDATE wp_posts SET post_content = replace(post_content, 'http://www.domain', 'https://www.domain');

mysql > UPDATE wp_options SET option_value = replace(option_value, 'http://www.domain', 'https://domain');

mysql > UPDATE wp_posts SET guid = replace(guid, 'http://www.domain','https://www.domain');

mysql > UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.domain','https://www.domain');

mysql > flush query cache; #force updates on the mysql server caches!

mysql > quit;

Testing:

  • Login into your Blog on WordPress and check results and view, save and change all basics settings again on area settings an reading, cause much files are often „cached“ by Browsers, Proxy’s or by Cache Plugins!
  • Change wp-config.php add this „define(‚FORCE_SSL_ADMIN‘, true);“ to force https for Admin Login.
  • Check the Widgets! Cause you can’t change all URL’s at the MySQL Database, cause the Widgets creates „dynamic“ URL-Path Entry’s!!!