Knowledgebase

Moving WordPress from a Subfolder to the Root Domain Print

  • wordpress, domain, php, https, filemanager, cpanel, database, backup, htaccess, permalinks
  • 0

If you installed into a folder such as /wp and your site now loads at yourdomain.com/wp, here is how to move it to the root.

Steps

  1. Take a full backup.
  2. In WordPress go to Settings → General. Leave WordPress Address (URL) as https://yourdomain.com/wp but change Site Address (URL) to https://yourdomain.com. Save. The dashboard will still be reachable at /wp/wp-admin.
  3. In cPanel File Manager, copy index.php and .htaccess from the wp folder up into public_html.
  4. Edit the copied public_html/index.php and change the last line from require __DIR__ . '/wp-blog-header.php'; to require __DIR__ . '/wp/wp-blog-header.php';
  5. Visit yourdomain.com — the site should load at the root.
  6. Go to Settings → Permalinks and click Save to regenerate rewrite rules.

Alternative — move everything

If you would rather have no subfolder at all, select all files inside wp in File Manager, use Move to relocate them to public_html, then update both URL fields to the root domain and run a search-replace on the database for /wp in image paths.

Check that images in older posts still load afterwards; they often carry the old absolute path.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot