{"id":2324,"date":"2016-05-29T16:32:27","date_gmt":"2016-05-29T23:32:27","guid":{"rendered":"http:\/\/www.designersgate.com\/blogs\/?p=2324"},"modified":"2021-11-10T19:11:25","modified_gmt":"2021-11-10T19:11:25","slug":"moving-wordpress-domain","status":"publish","type":"post","link":"https:\/\/designersgate.com\/blog\/moving-wordpress-domain\/","title":{"rendered":"Moving WordPress\u00ae to a new Domain or Directory, or creating a Test Environment Playground"},"content":{"rendered":"\n<p class=\"has-accent-color has-text-color\">IMPORTANT NOTE 2021 &#8211; THIS POST IS 7 YEARS OLD POST AND MANY OF THE STEPS SUGGESTED DO NOT WORK WITH NEW VERSIONS OF WORDPRESS FOR INSTANCE:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>GD PRESS TOOLS is not longer free or not available<\/li><li>site_url and home_url variables has been REMOVED<\/li><\/ul>\n\n\n\n<p class=\"has-accent-color has-text-color\">ONLY FOLLOW THESE STEPS IF YOU HAVE WORDPRESS VERSION 4.5.24 OR OLDER &#8211; WHICH YOU SHOULDN&#8217;T &#8211; YOU&#8217;VE BEEN WARNED.<\/p>\n\n\n\n<p>WHAT MIGHT STILL WORKS IS REPLACING TEXT WITH MYSQL COMMANDS WHICH IS PART OF MYSQL FUNCTIONS AND HAVEN&#8217;T BEEN DEPRECATED<\/p>\n\n\n<p>Hello Web Developers&#8230;<\/p>\n<p>This is a extensive tutorial\u00a0for those of you who develop with <a href=\"http:\/\/wordpress.org\">WordPress<\/a>. WordPress is an amazing platform to build on. Either for just a section of your website or as whole <a href=\"http:\/\/en.wikipedia.org\/wiki\/Content_management_system\">CMS<\/a> (Content Management System), WordPress has become the leader platform not only for web professionals, but also for adventurers, that&#8217;s right&#8230; WordPress is getting Web Developers out of job.<\/p>\n<p>Do not worry, web is not only about website design&#8230; there&#8217;s a whole lot for web developers in the Cloud than that you can imagine. You only have to dig in a little deeper.<\/p>\n<p><!--more--><\/p>\n<p>Now, if you are a WordPress developer, you might bump into a situation where you have to move it from one domain to another, even changing it to a sub folder&#8230; this also applies taking\u00a0over an already established WordPress project, to create and\u00a0install it into you localhost playing ground or Sandbox.<\/p>\n<p>It is very simple to do, and you might be surprise how simple it is. To accomplish this task you can do it the easy way or the hard way. Let&#8217;s do it the hard way first so you can appreciate the easy way later. This means creating a local copy of the database and WordPress itself.<\/p>\n<p>If you only have to change the location to a different directory under the same URL, just skip to the Easy Way (Step 5).<\/p>\n<p><strong>Importing and Modifying data storage tables on\u00a0MySQL Instance.<\/strong><\/p>\n<h1>REQUIREMENTS<\/h1>\n<ol>\n<li>MySQL already installed (I suggest to install same version as your hosting)<\/li>\n<li>Apache or IIS Servers installed and running<\/li>\n<li>PHP already installed (I suggest also the same version as your hosting)<\/li>\n<li>FTP Access to WordPress current instance.<\/li>\n<\/ol>\n<p>Before we get started, for this, you will require a couple of MySQL management tools as well.<\/p>\n<p>To execute the steps I will talk about in a couple of paragraphs,\u00a0you need to have access to administrative tools. You can either execute the\u00a0statements I will mention on\u00a0the shell (Terminal, PowerShell or Command Prompt), and also through <a href=\"https:\/\/www.phpmyadmin.net\/\">PHPMyAdmin<\/a>, if it is available to you. Also you can use SQL Management Applications like <a href=\"http:\/\/www.mysql.com\/products\/workbench\/\">MySQL Workbench<\/a> (my first option). Some hosting services allows you to connect through a shell using tools like PuTTy, a Windows\u00a0Environment Unix-Base shell to execute shell commands through SSH (Secure SHell). \u00a0For preference, I use <a href=\"\/\/www.bluehost.com\/track\/raphievila\/WP-Move\">BlueHost<\/a>\u00a0for hosting.<\/p>\n<p>To connect to your Remote Host Shell In Linux or Mac OS X you can follow these tutorials: (I haven&#8217;t look at these tutorials but I assumed they are OK, for <a href=\"http:\/\/blog.arvixe.com\/how-to-connect-via-ssh-with-a-linux-terminal\/\">Linux<\/a> and for <a href=\"https:\/\/support.rackspace.com\/how-to\/connecting-to-linux-from-mac-os-x-by-using-terminal\/\">Mac OS X<\/a>) Also refer to your hosting documentation.<\/p>\n<p><a href=\"\/\/www.bluehost.com\/track\/raphievila\/WP-Move\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter\" src=\"\/\/bluehost-cdn.com\/media\/partner\/images\/raphievila\/468x60\/bh-468x60-03-dy.png\" border=\"0\" \/><\/a><\/p>\n<p>Of course, if you don&#8217;t have access to the database you cannot do anything with it, so I am assuming that you have administrative access to it. If you do not, you will need to recreate an SQL Structure\/Data with a third-party plugin as <a href=\"https:\/\/plugins.dev4press.com\/gd-press-tools\/\">GD Press Tools<\/a>, my personal favorite or other similar plugins. GD Press Tools in no longer available as free version on the WordPress Plugins Repository, so if you are looking for free options just search &#8216;database backup&#8217; under &#8216;Add New&#8217; on the Plugins Dashboard.<\/p>\n<p>To create a back up with GD Press Tools it is easy, first go to the Database Section under the GD Press Tools tab on your admin dashboard:<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2331\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools.png\" alt=\"backing-up-gdpresstools\" width=\"835\" height=\"375\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools.png 835w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-600x269.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-300x135.png 300w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-768x345.png 768w\" sizes=\"auto, (max-width: 835px) 100vw, 835px\" \/><\/a><\/p>\n<p>Unchecked the option &#8216;Save database backup as GZIP archive&#8217; because is buggy and corrupt the file, most of the time.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2332\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-2.png\" alt=\"backing-up-gdpresstools-2\" width=\"814\" height=\"371\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-2.png 814w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-2-600x273.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-2-300x137.png 300w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/backing-up-gdpresstools-2-768x350.png 768w\" sizes=\"auto, (max-width: 814px) 100vw, 814px\" \/><\/a><\/p>\n<p>Click on Backup button, when the process is finished you can download the backup file under the same section where you created it, or by the URL showed at the top of the Settings section, &#8216;\/wp-content\/gdbackup&#8217; by default. See image above.<\/p>\n<p><strong>Note: This is a good idea also before you make a framework update, from one version to another or backing up your system for DR (Disaster Recovery). Never make updates without backing up your system, consider this before installing or updating plugins as well.<\/strong><\/p>\n<hr \/>\n<h1>Step 1. Setting up your Sandbox (Localhost Playground):<\/h1>\n<p>If you were able to create the\u00a0SQL back up file, loading it to your local MySQL Instance is quite simple with MySQL Workbench. You can also load it with the <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.5\/en\/loading-tables.html\">shell as well<\/a>. But I will concentrating using a more user friendly tool, of course, the shell it is more trusted. Actually, Workbench uses the MySQL shell on the background, just making it easier for you.<\/p>\n<p>MySQL Workbench is available for Windows, Linux, and Mac OS X, so you can really manage you MySQL in any platform the same way.\u00a0I will not go through the process of installing Workbench, but it is straight forward. Just search for &#8216;<a href=\"https:\/\/www.bing.com\/search?q=Installing+Workbench&amp;pc=Z192&amp;form=ZGACDF&amp;install_date=20110828&amp;toHttps=1&amp;redig=BED9150D2442412F833683EB9B3486E5\">Installing MySQL Workbench<\/a>&#8216;.<\/p>\n<p>When you open Workbench for the first time, you will notice that you MySQL local instance will show up, so there is nothing to configure, assuming MySQL is already installed in your system. If your hosting allows you to connect to your MySQL host remotely, you can skip the backup process and the next instructions, because you can accomplish this more easily <a href=\"http:\/\/dev.mysql.com\/doc\/workbench\/en\/wb-mysql-connections-new.html\">Creating a new Connection on\u00a0Workbench<\/a>, and request your hosting for the credential information, this might requires an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ssh-keygen\">SSH private key<\/a>.\u00a0But for now let&#8217;s keep setting up our local instance.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/workbench-local-instance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2333\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/workbench-local-instance.png\" alt=\"workbench-local-instance\" width=\"560\" height=\"318\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/workbench-local-instance.png 560w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/workbench-local-instance-300x170.png 300w\" sizes=\"auto, (max-width: 560px) 100vw, 560px\" \/><\/a><\/p>\n<p>Click on this instance and enter the credentials you set up during installation (User\/Password), you can choose to save the password if you want, but I do not recommend. I do recommend using the root user when using Workbench.<\/p>\n<p>When you up and running, create a new schema with the same name as the schema of your previous WordPress installation, you can RENAME the schema later, if you want to. I would copy the wp-config.php into the new URL version.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/new-schema.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2334\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/new-schema.png\" alt=\"New Schema Workbench\" width=\"425\" height=\"185\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/new-schema.png 425w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/new-schema-300x131.png 300w\" sizes=\"auto, (max-width: 425px) 100vw, 425px\" \/><\/a><\/p>\n<p>Then you will dump all the data using the backup file you just created. On your left menu bar, click on Data Import\/Restore tab.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/data-import.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2335\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/data-import.png\" alt=\"data-import\" width=\"548\" height=\"320\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/data-import.png 548w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/data-import-300x175.png 300w\" sizes=\"auto, (max-width: 548px) 100vw, 548px\" \/><\/a><\/p>\n<p>Then checked &#8216;Import from Self-Contained File&#8217;, browse for the back up you just downloaded, select schema to dump the information, also in the selection box at the bottom of the screen, select &#8216;Dump Structure and Data&#8217; and Start Import.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/select-import-file.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-2336 size-full\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/select-import-file.png\" alt=\"select-import-file\" width=\"1187\" height=\"894\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/select-import-file.png 1187w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/select-import-file-600x452.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/select-import-file-300x226.png 300w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/select-import-file-1024x771.png 1024w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/select-import-file-768x578.png 768w\" sizes=\"auto, (max-width: 1187px) 100vw, 1187px\" \/><\/a><\/p>\n<p>If you have the same MySQL version installed in your local environment, you should not have any problem. If you decided to update to a later version than your hosting, you might encounter DATETIME default values issues. In that case, that it is another tutorial to cover, but not here. <a href=\"http:\/\/stackoverflow.com\/questions\/24259090\/datetime-and-timestamp-issue-while-creating-mysql-table\">If you need help with that now, just click here<\/a>.<\/p>\n<h1>Step 2. Setting Up an User<\/h1>\n<p>You have to set an user for WordPress as well, never use your root user for WordPress, unless you do not mind an stranger snooping around your data.<\/p>\n<p>On the left menu click on &#8216;User and Privileges&#8217;, once clicked, click on the button at the bottom center of the screen that&#8217;s labeled &#8216;Add User&#8217; and you will create an user with the same information you have in the current installation of WordPress wp-config file:<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/creating-user-mysql.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2345\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/creating-user-mysql.png\" alt=\"creating-user-mysql\" width=\"516\" height=\"156\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql.png 516w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql-300x91.png 300w\" sizes=\"auto, (max-width: 516px) 100vw, 516px\" \/><\/a><\/p>\n<p>For the moment, make sure you Limit to Hosts &#8216;localhost&#8217;, do not user 127.0.0.1 or % wildcard, for any reason, this does not work, and it is not safe either. Set the Authentication Type to Standard, which is what you need for host based authentication.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/creating-user-mysql2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2346\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/creating-user-mysql2.png\" alt=\"creating-user-mysql2\" width=\"653\" height=\"312\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql2.png 653w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql2-600x287.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql2-300x143.png 300w\" sizes=\"auto, (max-width: 653px) 100vw, 653px\" \/><\/a><\/p>\n<p>When done, press Apply, and when it is processed and registered, go to &#8216;Schema Privileges&#8217; Tab. Where you will select the schema you created for WP and grant all privileges to that schema only.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/creating-user-mysql3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2347\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/creating-user-mysql3.png\" alt=\"creating-user-mysql3\" width=\"1026\" height=\"549\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql3.png 1026w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql3-600x321.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql3-300x161.png 300w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql3-1024x548.png 1024w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql3-768x411.png 768w\" sizes=\"auto, (max-width: 1026px) 100vw, 1026px\" \/><\/a><\/p>\n<p>Click OK, and the check all privileges check boxes. Make sure to check the &#8216;GRANT OPTION&#8217; check box as well or WP will not work.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/creating-user-mysql4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2348\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/creating-user-mysql4.png\" alt=\"creating-user-mysql4\" width=\"727\" height=\"355\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql4.png 727w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql4-600x293.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/creating-user-mysql4-300x146.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/a><\/p>\n<p>Once this is done&#8230; your are ready to install WordPress.<\/p>\n<h1>Step 3. Installing WordPress on your Local Environment<\/h1>\n<p>Now you need to install WordPress locally by downloading the files to your server with and FTP Client (<a href=\"https:\/\/filezilla-project.org\/download.php?type=client\">Filezilla <\/a>or <a href=\"http:\/\/winscp.net\/eng\/download.php\">WinSCP<\/a>). If you are on Windows, I recommend the later.<\/p>\n<p>I am assuming you know how to use the FTP Client and how to download the files, if not <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/cc295154.aspx\">check this tutorial<\/a>\u00a0or <a href=\"https:\/\/www.bing.com\/videos\/search?q=how+to+use+filezilla+ftp&amp;qpvt=how+to+use+filezilla+ftp&amp;FORM=VDRE\">using FileZilla<\/a>. Once these\u00a0is done and if you kept the credentials the same as it was in the previous installation, you do not need to do anything else. But if you are going to use <a href=\"http:\/\/www.iis.net\/\">Microsoft IIS (Internet Information Services) Server on Windows<\/a> as the local server you need to grant WordPress writing privileges only to it&#8217;s directories, most importantly the \/wp-content\/uploads. If you are in Apache you can skip to Step 3.<\/p>\n<p>To grant updating and writing authorization to WordPress from the Dashboard, so you can be able to install plugins and make updates, you have to grant this privileges as follow. Locate the WordPress directory and right click for the option menu and select &#8216;Properties&#8217;.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/granting-access-IIS.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2342\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/granting-access-IIS.png\" alt=\"granting-access-IIS\" width=\"767\" height=\"306\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/granting-access-IIS.png 767w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/granting-access-IIS-600x239.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/granting-access-IIS-300x120.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/a><\/p>\n<p>On the Security Tab, click on Edit and add two user, one at a time, <strong><em>IUSR<\/em><\/strong> and <strong><em>IIS_IUSRS<\/em><\/strong>, and set permissions to Full Control if available or select Modify, Write and Read &amp; Execute:<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/granting-access-IIS-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2343\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/granting-access-IIS-2.png\" alt=\"granting-access-IIS-2\" width=\"549\" height=\"263\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/granting-access-IIS-2.png 549w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/granting-access-IIS-2-300x144.png 300w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/a><\/p>\n<p>Hit Apply or OK if you are done.<\/p>\n<p>Warning: This will expose your IIS Server as it expose any Web\u00a0Server to WordPress, which means, you need to understand web security\u00a0threat issues. If you think you are safe because you use Linux or Mac OS X, you are fried, <a href=\"http:\/\/thehackernews.com\/2015\/02\/vulnerable-operating-system.html\">read this<\/a>&#8230; No one is exempt of cyber attacks, so take all measures possible to avoid being exposed or attacked.<\/p>\n<hr \/>\n<p><strong>UPDATE<\/strong>: If you still have some problems trying to update or install plugins with a Fatal Error saying it couldn&#8217;t find an SSL certificate of the sort, download the Mozilla certificate <a href=\"https:\/\/curl.haxx.se\/ca\/cacert.pem\">here<\/a> (right click and save as), save it anywhere you want. If you have your PHP Manager for IIS&#8230; would look something like this<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2405\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate.png\" alt=\"certificate\" width=\"332\" height=\"232\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate.png 332w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate-300x210.png 300w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/a><\/p>\n<p>Double click it, and look for the php.ini file link:<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2402\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate2.png\" alt=\"certificate2\" width=\"751\" height=\"434\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate2.png 751w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate2-600x347.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate2-300x173.png 300w\" sizes=\"auto, (max-width: 751px) 100vw, 751px\" \/><\/a><\/p>\n<p>If you don&#8217;t, create a phpinfo.php file and save it somewhere inside your local website with the following code:<\/p>\n<pre>&lt;?php\n    echo phpinfo();\n?&gt;<\/pre>\n<p>Navigate to the php file you just created in the browser and check the location of the php.ini file IIS is reading to render PHP.<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2410\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate5.png\" alt=\"certificate5\" width=\"678\" height=\"230\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate5.png 678w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate5-600x204.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate5-300x102.png 300w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><\/a><\/p>\n<p>The location of your php.ini file might be in a different location, once you spot it, look for the file and run\u00a0your favorite text editor as administrator, and open the php.ini file.<\/p>\n<p>Then look for the curl.cainfo statement, uncomment it and add the URL where you saved the cacert.pem for example:<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2403\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate3.png\" alt=\"certificate3\" width=\"794\" height=\"209\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate3.png 794w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate3-600x158.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate3-300x79.png 300w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate3-768x202.png 768w\" sizes=\"auto, (max-width: 794px) 100vw, 794px\" \/><\/a><\/p>\n<p>Remember to enter the location where you saved your file, the image above it is just an example.<\/p>\n<p>Save it and restart IIS, normally changes made on the setting file is automatically populated when using PHP Manager, but just in case reset, I prefer to do it on PowerShell, it&#8217;s as simple as typing <strong>iisreset<\/strong>:<\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2407\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/certificate4.png\" alt=\"certificate4\" width=\"528\" height=\"253\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate4.png 528w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/certificate4-300x144.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/a><\/p>\n<p>Remember to run\u00a0powerShell as administrator. Now you should be able to get rid of the pesky Fatal Error.<\/p>\n<hr \/>\n<p>Now that you have your data storage synchronized and the new instance of WordPress installed in your local folder, let&#8217;s update the domain the hard\u00a0way&#8230; But if you prefer skip to the easy way on Step 5.<\/p>\n<h1>Step 4: Understanding and Executing String Replacement on SQL. Updating the URL the Hard way.<\/h1>\n<p>As in many developing languages, SQL let you replace a string with another string by using the REPLACE() method or function. How it works is as follow:<\/p>\n<p><code>UPDATE `table` SET `column_to_be_affected` = REPLACE(`column_to_be_affected` , 'http:\/\/current_url', 'http:\/\/newurl') WHERE `column_to_be_affected` LIKE '%http:\/\/current_url%';<\/code><\/p>\n<p>This statement has to be executed on the OPTIONS database, by default <code>wp_options<\/code>. Also, you might want to execute it on other tables if you have links pointing to the old url, for example: wp_comments, wp_posts, wp_links. But let me warned you, make sure you replace the url that start with &#8216;http:\/\/&#8217; prefix, if not you will be replacing other things you might not expect, like emails. So be careful.<\/p>\n<p>Once you have executed this successfully on your localhost is time to do the same in your hosting. (Again, you need access to PHPMyAdmin or the ability to import data into your production server to do this. If not, the hosting administrator have to do it for you.)<\/p>\n<h1>Step 5: Updating the URL the easy way.<\/h1>\n<p>In your favorite\u00a0text editor (<a href=\"https:\/\/notepad-plus-plus.org\/\">Notepad++<\/a>, <a href=\"http:\/\/brackets.io\/\">Brackets<\/a>, <a href=\"http:\/\/43070455.r.msn.com\/?ld=d3bYXJ1nsOWVhpes2OzCJ_IjVUCUz1v9AXYLq5rMWCWD8n00tnKdZllcEnGeRJnQDEL252gi2jrO68_qIHmi6eqywa31ga8DEngM8Z1H1DNtZGwLbN8A-b0gjV_25sc4vfxYX4mWSGwA1rrSKQqFrBEFHTUTdNGTA6JzOwUni-3woYPgRH&amp;u=http%3a%2f%2f4056.xg4ken.com%2fmedia%2fredir.php%3fprof%3d460%26camp%3d11797%26affcode%3dcr211%26k_inner_url_encoded%3d1%26cid%3d10591617098%7c33460%7cvisual%2520studio%2520code%26mType%3de%26queryStr%3dvisual%2520studio%2520code%26kdv%3dc%26url%5b%5d%3dhttp%253A%252F%252Fcode.visualstudio.com%252F%253Fwt.mc_id%253DDX_834369%2526utm_source%253Dbing%2526utm_medium%253Dpaid%2526utm_content%253D1%2526utm_campaign%253DCorp-FY16Q3March-Dev-PJVS\">Visual Studio Code<\/a>) or IDE (<a href=\"https:\/\/netbeans.org\/\">Netbeans<\/a> or\u00a0<a href=\"http:\/\/www.microsoft.com\/en-us\/download\/details.aspx?id=48146\">Visual Studio Community<\/a>), my favorites being Notepad++, Brackets and Netbeans*, although Visual Studio Code has a neat integration with GitHub versioning.<\/p>\n<p>Open your theme function file, normally<em> &#8216;functions.php&#8217;\u00a0<\/em>and enter the following statements before every other statement:<br \/><code><br \/>\nupdate_option('siteurl', 'http:\/\/domain_location');<br \/>\nupdate_option('home', 'http:\/\/domain_location');<br \/>\n<\/code><\/p>\n<p><a href=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/adding-statement-function.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2338\" src=\"http:\/\/www.designersgate.com\/blogs\/wp-content\/uploads\/2016\/05\/adding-statement-function.png\" alt=\"adding-statement-function\" width=\"688\" height=\"374\" srcset=\"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/adding-statement-function.png 688w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/adding-statement-function-600x326.png 600w, https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/adding-statement-function-300x163.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/a><\/p>\n<p>Obviously, replace http:\/\/domain_location with your new DNS or URL location. Save the changes and run the WordPress web application once. That&#8217;s it, just make sure the home button link and other links reflect the new location. You can to this by logging in to the administrative area, if you are taken to the old domain, changes are not reflected. Go back to the local instance or the new domain, refresh the page with function key five (F5). If still nothing happens, clear your browser cache.<\/p>\n<p>If still this does not do it, you might need to go the hard way, try by adding the following line into your wp-config.php file, located in the root directory of WordPress:<br \/><code><br \/>\ndefine('WP_HOME','http:\/\/domain_location');<br \/>\ndefine('WP_SITEURL', 'http:\/\/domain_location');<br \/>\n<\/code><\/p>\n<p>Same as with the function file, you will replace the http:\/\/domain_location with your actual location, if is your localhost would be &#8220;http:\/\/localhost&#8221; or &#8220;127.0.0.1&#8221;, assuming you left everything set as default.<\/p>\n<p>If none\u00a0of these methods work, unfortunately you will have to go the hard way. Sorry.<\/p>\n<h1>Conclusion<\/h1>\n<p>Well, that&#8217;s all. What make this tutorial longer was moving your WordPress to a new domain or creating a testing environment. Of course, I am not dealing with specific challenges that you can find installing WordPress under IIS or Xampp, neither installing MySQL, Apache\/IIS and PHP on\u00a0your test environment. There are plenty tutorials around to accomplish this tasks.<\/p>\n<p>But it is simple to update the URL path if it is just changing the directory under the same domain.<\/p>\n<p>Happy Coding.<\/p>","protected":false},"excerpt":{"rendered":"<p>IMPORTANT NOTE 2021 &#8211; THIS POST IS 7 YEARS OLD POST AND MANY OF THE STEPS SUGGESTED DO NOT WORK WITH NEW VERSIONS OF WORDPRESS FOR INSTANCE: GD PRESS TOOLS is not longer free or not available site_url and home_url variables has been REMOVED ONLY FOLLOW THESE STEPS IF YOU HAVE WORDPRESS VERSION 4.5.24 OR [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2412,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,7],"tags":[200,190,201,202,203,204,78,205,46,206,207,208],"class_list":["post-2324","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-app-reviews","category-tutorials","tag-bluehost","tag-brackets","tag-dns","tag-gd-press-tools","tag-location","tag-migrating","tag-mysql","tag-new","tag-notepad","tag-ssh","tag-visual-studio","tag-wordpress"],"acf":[],"jetpack_featured_media_url":"https:\/\/designersgate.com\/blog\/wp-content\/uploads\/2016\/05\/DG-WP-MOVE-1.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/posts\/2324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/comments?post=2324"}],"version-history":[{"count":2,"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/posts\/2324\/revisions"}],"predecessor-version":[{"id":2902,"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/posts\/2324\/revisions\/2902"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/media\/2412"}],"wp:attachment":[{"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/media?parent=2324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/categories?post=2324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/designersgate.com\/blog\/wp-json\/wp\/v2\/tags?post=2324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}