Search This Blog

How to move a WordPress sites to a sub-domain or directory within the same server?


If you have a WordPress sites that you need to move within the same server, this post might help you. When a WordPress site is moved to a new location on the same server, what is basically changed is the URL to access the site.

For this example, suppose you were running WordPress website on the ROOT directory of your host or server, and you would like to move it to a sub-domain or a sub-directory, then follow the following steps. As we are moving the WordPress site within the same server, there is no need to move the database.

MOVING THE WORDPRESS FILES
  • Create a sub-domain or sub-directory
Login to your host account control panel and create a sub-domain or sub-directory. If your host's control panel is using CPANEL, you can create sub-domain in CPANEL > DOMAIN > SUBDOMAINS.

I have separately mentioned sub-domain and sub-directory, because they are sightly different. Sub-domain means you want the site to be accessed using http://subdomain.domain.com. And sub-directory means you want to access the site using the URL http://domain/subfolder .

That is the only difference, otherwise, both will have the same sub-folder under root. And the process is the same to move the files.

  • Move all the WordPress files to the sub-directory
Move the WordPress files from the root directory to the sub-directory.
Take care if there is any other files other than WordPress in the root directory, such as files from another sub-directory and others. WordPress creates three main folders "wp-content", "wp-admin' and "wp-includes". Besides the three folders there will be a few other ".php" files. Don't miss out any of those files.

 After you have finished moving the WordPress files, you sites should now be accessible with the URL http://subdomain.domain.com if you have created a sub-domain or http://domain/subfolder if you did not create a sub-domain.

By accessing the site using any of the URLs above, you would realize that the site is not displaying correctly. That is because, when you first installed the WordPress site, the site URL is set to the main domain http://domain.com. We need to change that.

  • Changing the WordPress Site's domain in MySql database using phpMyAdmin
From your host's account panel, login to phpMySql. If you host's control panel is using CPANEL, you can find phpMyAdmin in CPANEL > Databases.

  • Once in phpMyAdmin, click on the root on the left hand side to expand. 
  • Find the WordPress's database to expand. 
  • In the tables, find "Wp-options".
  • Click on the ‘Browse’ icon on the left in the top menu
  • Find siteurl in the ‘option_name’ column, click the Pencil (Edit) icon and change
    option_value’ from http://www.domain.com to http://www.subdomain.domain.com or http://www.domain.com/sub-directory (depending on whether you have setup sub-domain or not).
  • Find home (in the same page or next page) in the ‘option_name’ column, click the Pencil (Edit) icon and change ‘option_value’ from http://www.domain.com to http://www.subdomain.domain.com or http://www.domain.com/sub-directory (depending on whether you have setup sub-domain or not).

 That's it.
Your moved WordPress sites should now be accessible using the new URL.


You can also learn more about moving a WordPress site here.


Sponsored Links


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...