Perplexingly Relocating Your WordPress Site to a New Directory
Are you feeling befuddled about moving your WordPress site to a new directory? This can be a harrowing journey, especially for unseasoned developers. Nevertheless, there are times when it’s crucial to relocate your site to enhance its performance or bolster its security. Perhaps you need to redesign your website or switch web hosts. In this absorbing guide, we will take you through the intricate process of moving WordPress to another directory.
Understanding the Intricacies of Moving WordPress to Another Directory
Usually, when you shift to a new host, domain, or directory, you must move all the files, content, and databases from your WordPress installation. Moving your WordPress site to another directory involves two main steps: transferring the files and changing the URLs in the database. You can move all WordPress files manually, but this is time-consuming and requires advanced technical skills.
Step 1: Creating a Backup
Before embarking on moving your site to another directory, ensure you have a backup of all the critical WordPress files. This backup may save you from experiencing any issues during the migration process. Make sure you copy all the files containing the database, themes, and plugins. You can use a plugin or do it manually.
Step 2: Installing WordPress in the New Directory
The next step is to install a fresh WordPress installation in the new directory. You can install it in the root domain or a subordinate directory if you want to run two separate WordPress sites on the same domain. You can install WordPress in two ways: Using Softaculous or manual installation.
Option 1: Using Softaculous
The one-click installer, Softaculous, makes it easier to install WordPress in cPanel. Here’s how you can install WordPress using Softaculous:
- Log in to your cPanel account
- Scroll down to the Softaculous Apps Installer section and click WordPress
- Click the Install Now button
- Fill in the required information, such as the name of the site, username, password, etc.
- Choose the directory where you want to install WordPress.
- Click the Install button and wait for the installation process to complete.
Option 2: Manual Installation
If you prefer to install WordPress manually, you can do so by following these steps:
- Download and unzip the latest version of WordPress to your computer
- Create a new directory on your web server for the new installation
- Upload the WordPress files to the new directory
- Create a new database for the new WordPress installation
- Configure the wp-config.php file with your database credentials
- Run the WordPress installation script.
Step 3: Export Your Database
After installing WordPress in the new directory, the next step is to export your site’s database. The database contains all your content and settings, so you need to export and later import it into the new installation.
To export your WordPress database, log in to your hosting account’s cPanel and navigate to phpMyAdmin. Select the database you want to export, click the Export tab, and choose the Quick export option. Click the Go button, and a file with the extension .sql will be downloaded to your computer.
Step 4: Import Your Database
Now that you have exported your site’s database from the old site, you need to import it into the new site’s database. To do this, log in to your new host’s cPanel and navigate to phpMyAdmin. Select your new database, click the Import tab, and click the Choose File button. Choose the .sql file you exported in step 3 and click the Go button to import the database.
Step 5: Modify the URLs
After importing the database, you need to modify the URLs in your WordPress database to correspond to the new URLs of your site. Log in to the new WordPress site’s dashboard, navigate to Settings > General, and change the URLs in the WordPress Address (URL) and Site Address (URL) fields.
Once you have updated the URLs in the new database, update the URLs in the old database’s export file too. Open the .sql file with a text editor like Notepad ++ or Sublime Text, and replace all instances of the old URL with the new URL. Save the modified file.
Step 6: Upload the Site to the New Directory
The next step is to copy all the files from the old WordPress installation directory to the new directory where you installed the new WordPress site. You can do this manually by using an FTP client or by using a migration plugin like All-in-One WP Migration. Ensure all the files are uploaded correctly.
Step 7: Update Your Permalinks
Finally, update your site’s permalinks to ensure all your links work correctly. Navigate to Settings > Permalinks in your WordPress dashboard and click the Save Changes button.
Perplexingly relocating your WordPress site to another directory is challenging, but it becomes easier once you follow the above steps carefully. Always remember to create a backup of your site before making any significant changes. The steps above will help you move your WordPress site to another directory without losing any content or SEO rankings. Keep in mind that moving your WordPress site usually addresses issues with your site’s performance or security.