How do I move my WordPress from a subdirectory to the root or top directory?

Short answer: if WordPress is installed in a folder such as /wp but you want the site to open at example.com, change the Site Address in WordPress, copy two files to the main folder, and edit one line.

This is the method described by WordPress.org as "giving WordPress its own directory". Make a backup first.

Steps

  1. Log in to WordPress. Go to Settings, then General.
  2. Leave WordPress Address (URL) as it is (for example https://example.com/wp).
  3. Change Site Address (URL) to your main address (for example https://example.com). Click Save Changes. You may see an error page. That is expected. Do not worry.
  4. In cPanel open File Manager. Copy the files index.php and .htaccess from the wp folder to public_html. (To see .htaccess, open Settings in File Manager and tick Show Hidden Files.)
  5. Edit index.php in public_html. Find the line that says require __DIR__ . '/wp-blog-header.php'; and change it to require __DIR__ . '/wp/wp-blog-header.php';. Use your real folder name instead of wp. Save.
  6. Open your main address. Then in WordPress go to Settings, Permalinks and click Save Changes.
The WordPress General Settings page with the WordPress Address and Site Address fieldsSettings, General: the two address fields are in the middle of the page.

Problems

If the site shows an error, restore your backup and check the folder name in step 5. For a full move of all files to the main folder instead, follow our migration guide or open a support ticket.

  • 2 Users Found This Useful
  • wordpress, move wordpress
Was this answer helpful?
Still stuck? Ask our AI assistant for help troubleshooting this.

Related Articles

Installing and setting up WordPress

Accessing Your Wordpress on AkolagTech Platform Thanks for signing up for our hosting plan, one...

Installing and setting up WordPress

Accessing Your Wordpress on AkolagTech Platform Thanks for signing up for our hosting plan, one...

Accessing your WordPress

Accessing Your Wordpress on AkolagTech Platform Thanks for signing up for our hosting plan, one...

Accessing your WordPress

Accessing Your Wordpress on AkolagTech Platform Thanks for signing up for our hosting plan, one...

How do I redirect/enable my Website or WordPress's website from HTTP to HTTPS by default

Short answer: your domain gets a free SSL certificate automatically. To make visitors always use...