How to Move WordPress to a Different Folder or Root Directory Print

  • wordpress, cpanel, file manager, phpmyadmin, database, website migration, wordpress move, subdirectory
  • 1

Moving your WordPress site from a subdirectory to your domain's root (or to another folder) involves relocating the files through cPanel File Manager and updating the database references through phpMyAdmin. This process ensures your site functions correctly at its new location without broken links or missing content.

Many site owners initially install WordPress in a subfolder like /wp or /wordpress, then later decide to move it to their domain's root directory for a cleaner URL structure. While this requires careful attention to both file locations and database settings, the process is straightforward when you follow the proper steps.

Moving WordPress Files to the New Location

The first step involves physically moving your WordPress files using cPanel's File Manager:

  1. Log into your cPanel account and open File Manager
  2. Navigate to the root directory (typically public_html)
  3. Remove any existing files in the destination folder, but do not delete the subfolder containing your current WordPress installation
  4. Open the subfolder where WordPress currently resides
  5. Click Select All to highlight all WordPress files and folders
  6. Click the Move button in the toolbar
  7. Enter the new path (for example, change "/public_html/wp" to "/public_html/" to move to your domain root)
  8. Click Move File(s) to complete the relocation

Your WordPress files are now in their new location, but the site won't work correctly until you update the database references.

Updating Database References in phpMyAdmin

WordPress stores your site's URL in the database, so you must update these references after moving files:

  1. Return to your cPanel home screen and open phpMyAdmin
  2. Select your WordPress database from the left sidebar (usually contains "wp" in the name)
  3. Click the Export tab at the top
  4. Click Go to download a backup copy of your database
  5. Open the downloaded SQL file using a text editor like WordPad or Microsoft Word (avoid Notepad as it can corrupt line breaks)
  6. Use the Find and Replace function to change all instances of your old URL path to the new one (example: replace "example.com/wp" with "example.com")
  7. Save the edited file
  8. Return to phpMyAdmin and select your database again
  9. Click Check All at the bottom of the table list
  10. Select Drop from the "With selected" dropdown menu to clear the existing tables
  11. Click the Import tab
  12. Choose your edited SQL file and click Go to import the updated database

Important Considerations When Moving WordPress

Before starting this process, create a complete backup of both your files and database. OBHost customers can use cPanel's backup tools or contact support for assistance with backups.

After completing the move, clear your browser cache (press CTRL+F5 or CMD+Shift+R) to see the changes. Some browsers cache website content, which can make it appear that the move didn't work when it actually did.

If your WordPress site uses a caching plugin, you'll also need to clear that cache after the move. Navigate to your WordPress admin panel and clear any plugin caches to ensure all URLs update correctly.

Alternative Method: WordPress Address Settings

For some moves, you can update the WordPress and Site Address directly in the WordPress admin panel before moving files:

  • Log into your WordPress dashboard
  • Go to Settings > General
  • Update the WordPress Address (URL) and Site Address (URL) fields to reflect the new location
  • Save the changes, then move your files as described above

This method works well for simpler moves but may not handle all URL references throughout your site, particularly in custom post types or serialized data.

Frequently Asked Questions

Will moving WordPress affect my SEO rankings?

Moving from a subdirectory to your root domain (like from example.com/wp to example.com) will change your URLs, which can temporarily impact rankings. Set up 301 redirects from old URLs to new ones using an .htaccess file or a redirect plugin to preserve SEO value and ensure visitors reach the correct pages.

What if I get a database import error in phpMyAdmin?

Database import errors usually occur due to file size limitations or syntax issues. If your database is large, increase the upload limit in php.ini or import the file in smaller sections. Ensure you edited the file with WordPad or a proper text editor, not Notepad, which can introduce formatting problems that cause import failures.

Can I move WordPress to a completely different domain?

Yes, the same process works for moving WordPress to a different domain name entirely. During the find and replace step, replace your old domain name with the new one (example: replace "oldsite.com" with "newsite.com"). You'll also need to point your new domain's DNS to your hosting account.

Do I need to reinstall plugins after moving WordPress?

No, your plugins and themes move with your WordPress files. They'll remain installed and configured exactly as before. However, some plugins that rely on absolute URLs may need their settings updated, and you should clear any caching plugins as mentioned earlier.

Moving WordPress between directories requires precision but follows a logical process. OBHost's support team is available 24/7 if you need assistance with this process or encounter any issues. Visit our contact page or email support@obhost.org for expert help with WordPress migrations and hosting questions.


Was this answer helpful?

« Back