Shifting a WordPress Web site from a Subdirectory to the Root
This can be a easy technique that can let you hold your WordPress set up in a subdirectory and use your root areas URL.
1. Again Up Your Web site
Its a good suggestion to have a backup, simply in case something goes incorrect. This contains your theme information, plugins, any media and your database.
You need to use any again up instrument you’re feeling most snug with. You could select to repeat your information to your laptop manually utilizing FTP or SFTP with FileZilla, a backup plugin like WordPress Backup to Dropbox or a third-party service like VaultPress.
Youll want to make sure you copy any hidden information like .htaccess.
2. Delete Any Current Web site
If theres an current web site within the root listing, youll have to take away it. If you wish to make a copy, now’s the time to again it up.
When you’ve got entry to Softalucous in your web sites cPanel, you possibly can simply uninstall WordPress from the foundation listing.
In any other case, login to phpMyAdmin and drop the database. Then delete all WordPress information.
three. Flip Off Fairly Permalinks

Login to your web site and go to Settings > Permalinksand flip off fairly permalinks by choosing the Default setting. Save adjustments.
four. Change Your Web site Handle
Go to Settings > Basic and alter the handle of your web site, however not the handle of WordPress. So in case your web site is instance.com/check, change your settings to the next:
- WordPress Handle (URL):http://example.com/test
- Web site Handle (URL): http://example.com
Save your adjustments, however dont refresh your web site simply but.
5. Copy and Edit Information
Login to your web site utilizing cPanel or FTP/SFTP and obtain two information to your laptop:
- index.php
- .htaccess solely if in case you have one. For those who dont, theres no have to create one.
Open index.php. Search for the next line:
require ('./wp-blog-header.php)
And exchange it with this:
require ('./subdirectoryname/wp-blog-header.php)
So for our web site, we might change the road to:
require ('./check/wp-blog-header.php)
Save index.php. Now, add each index.php and .htaccess to the foundation listing of your web site.
6. Flip On Fairly Permalinks
Return to Settings > Permalinks and switch fairly permalinks again on once more with the settings you want on your web site.
7. Take a look at Your Web site
While you enter the foundation area of your web site into your browser, the WordPress set up in your subdirectory will show, however with the foundation URL.
And thats all it’s essential to do to!
Shifting a WordPress Web site Between Hosts
This can be a bit trickier than transferring your web site from a subdirectory to the foundation listing. This time well really need to maneuver some information round.
1. Again Up Your Web site

Slightly than again up your web site in case something goes awry, you’ll need to again up information so we are able to copy them to the brand new server.
For this step, its finest to make use of FTP/SFTP and do issues manually. Connect with your previous web site and replica your whole information to a folder in your laptop. Dont neglect to incorporate any hidden information like .htaccess.
2. Export Database
Login to your web sites cPanel and go to phpMyAdmin. Choose the database on your WordPress web site after which click on Export on the prime of the web page.
Go away the default Fast possibility chosen and click on Go to obtain the database to your laptop.
three. Create WordPress Database On New Host Server
The following step is to create a database on the brand new server on your WordPress web site.
In cPanel, go to MySQL Databases and:
- Create a brand new database.
- Create a brand new MySQL consumer.
- Add consumer to the brand new database and grant All Privileges.
Dont neglect to write down down the database title, username and password for later.
four. Edit wp-config.php
For the reason that database data will likely be completely different on the brand new server, we have to replace our web sites wp-config.phpfile with the brand new particulars.
Amongst the information in your WordPress set up, which you downloaded earlier, youll discover a wp-config.php file. Make a replica of this file and rename it wp-config-old.php and put it aside elsewhere in your laptop. That is simply in case you make a mistake and want to revive the file.
Open the unique file. You have to to replace the database title, database username and database password so seize these particulars from the earlier step.
Discover the road:
outline('DB_NAME', 'db_name');
The db_name a part of this line would be the new title of your database. Substitute this with the title of the database you created earlier.
Subsequent, discover:
outline('DB_USER', 'db_user');
Change the db_user a part of this line to the username you created.
Lastly, observe down:
outline('DB_PASSWORD', 'db_password');
Substitute db_password with the password you created.
Save wp-config.php and shut it.
5. Import Database
Now that the database is up and operating, we have to import the .SQL file we exported earlier.
Open phpMyAdmin in cPanel and choose your new database. Click on the Import tab on the prime of the web page
Beneath File to Import, choose the database file you downloaded earlier.
Within the Partial Import part, un-check Permit the interruption of an import in case the script detects it’s near the PHP timeout restrict after which click on Go. After a short while, relying on the scale of your file, youll get a affirmation message that the file has been efficiently imported.

6. Add WordPress Information to New Server
Were virtually there. The following step is to add your web site to your new host.
Login to your web site utilizing FTP/SFTP and navigate to the place you wish to copy throughout your web site. In order for you your web site within the root listing of your web sites area, then copy your information to the public_html folder.
Go away the copy of your web site in your laptop in the interim so that youve obtained a backup.
7. Edit Database
To ensure that pictures and posts linking to different components of your web site to work, youll have to replace your area title in your database.
Its no good simply opening up your database and updating it manually since youll break any serialized knowledge. A fantastic script for that is Search Substitute DB. This script preserves serialized PHP strings when performing a search and exchange.
To make use of the script, add it to your web site, scan all of the tables after which enter what you wish to discover (your previous area title) and exchange (your new area title).
eight. Configure DNS Settings
Earlier than your web site will work along with your area title, you’ll need to reconfigure your areas DNS settings. You have to to login to the location internet hosting your area and level your area to your new net host.
This step is completely different for each net host, so its finest that you simply contact your host in the event youre undecided what to do.
9. Take pleasure in Your New Host
After your DNS adjustments have absolutely propagated (this could take as much as 48 hours), it is possible for you to to login to your WordPress web site in your new server with the username and password you used in your previous server.
Summing Up
Shifting your WordPress web site is a straightforward and simple course of, although its finest to take care with every step and make sure youve backed up your web site in case something goes incorrect.
For those who actually cant be bothered going to the difficulty of transferring your web site your self, there are plugins that may do all of the leg be just right for you. Ill discover these choices in a submit subsequent week, so keep tuned.
Have you ever ever moved a WordPress web site and one thing has gone horribly incorrect? Share your horror story within the feedback under.