Many of you have probably at least once in their hosting endeavors tried to move your website. Just registered a new hosting account with a new domain name because the old one didn’t get much traffic, and decided to move the old site and do a bit of rebranding. However after you have moved all the files, imported the databases and edited your config file like it is shown in this guide you open your WordPress with your brand new domain and it is not working and giving an error like “This site can’t be reached”. What is more, you can’t even log in your WordPress dashboard.
This is because of the fact that WordPress is a domain-dependent application, which means that the website is responding only to a specific domain name that is in its database. When you change the domain the content cannot be reached, even if you have moved the files in their proper directory and imported the database.
There are a few very simple steps that need to be taken so that you can fix this hindrance.
First, you need to open your cPanel and go to the File Manager and find the wp-config.php in the directory of your WordPress files. There, you need to find the name of your database (if you already know the name of the correct database, skip this step. Yet, it’s always best to be sure).
After you have learned the name of your database, go back to the cPanel home and find phpMyAdmin. There you will see all your databases like this :
Click on the correct database name so the menu under it will expand and find the row named “options“.
The rows you need to modify are called “siteurl” and “home” As you will see, next to those is the old domain name of your website. Edit it by clicking directly on the HTTP link (or the option Edit) and substitute the old domain with the new one. Press Enter or Save.
Reload your website and you should see it working. If you do not, try clearing your browser history and cache and try again.
After your home page is up, you might see Error 404 on your other pages. If this happens, log in your WordPress dashboard and navigate to Settings -> Permalinks. On this page, simply press Save. Then reload the site and make sure everything is working.
The same logic applies when a WordPress site is transferred from a subdirectory – “yourdomain.com/wp/” to the main folder. Make sure you transfer all the files from the “wp” folder to the main domain directory, without transferring the .htaccess. Then follow the steps above to change the URL in the database and reload the page.
As you have noticed I have mentioned you should not transfer the .htaccess file with the other files and folders. This is because one small mistake during editing it and your website might appear broken or unresponsive. However, when you go to website’s dashboard Permalinks and press Save that file and all its rules are automatically created with their new settings.
If for some reason the Permalinks save does not work and you still see error 404 on all pages, besides the home page, or if you cannot access the backend for some reason, here is how to edit the .htaccess directly.
Transfer the .htaccess file in the same folder where the wp-config.php file for the site is. Select it and from the menu above press Code Editor. Locate the following lines:
Notice how in “rewritebase” and “rewriterule” are shown as /wp/ and /wp/index.php. Go to those lines and make them look like this:
Then reload and check your website. If you still see errors, please contact your hosting provider for help. If you are a WebHostFace customer, you can contact one of our professional support representatives trained in WordPress and available 24/7!
This Post Has One Comment
lasertest10 Aug 2017
Wonderful goods from you, man. I’ve understand your stuff
previous to and you’re just extremely fantastic. I actually like what you have acquired here, certainly like what you’re saying and the way in which you say it.
You make it enjoyable and you still care
for to keep it wise. I cant wait to read far more from you.
This is actually a tremendous site.