# Moving a website from a subfolder to the main domain

> Built your site in a folder like /new or /wp? Here's how to move it so it opens at yourdomain.com instead.

Source: https://helpcenter.ruachost.com/cpanel/files/moving-a-website-from-a-subfolder-to-the-main-domain/

Sometimes a website is built in a subfolder, so it opens at an address like `example.com/new` or `example.com/wp`. When it's ready, you'll want it to open at `example.com` instead. In these steps, replace `example.com` with your own domain and `new` with your folder's name.

> **Using WordPress?:**
You can keep WordPress in its folder and only change the address it shows. See [Redirecting the main domain to an existing WordPress install](https://helpcenter.ruachost.com/wordpress/guides/redirecting-the-main-domain-to-an-existing-wordpress-install/). If you'd rather move the files, follow the steps below.

## Before you start

[Make a backup](https://helpcenter.ruachost.com/cpanel/files/managing-backups-in-cpanel/) of your files and database. If anything goes wrong, you can put everything back.

## Step 1: Clear out the main folder

Your main domain loads from the `public_html` folder.

1. In cPanel, open **File Manager** and go to `public_html`.
2. Turn on **Show Hidden Files** in **Settings** (top right), so you can see files such as `.htaccess`.
3. Move any old files you no longer need out of `public_html`, for example into a new folder called `old-site`. Leave your subfolder (`new`) where it is.

## Step 2: Move the files up

1. Open your subfolder (`public_html/new`).
2. Click **Select All**, then **Move**.
3. Change the destination to `/public_html` and click **Move Files**.
4. Check that `index.php` or `index.html` is now directly inside `public_html`.

## Step 3: Update your site's address

**WordPress:**

1. Log in to phpMyAdmin, open your site's database and the `wp_options` table (the `wp_` prefix may differ).
2. Change `siteurl` and `home` from `https://example.com/new` to `https://example.com`.
3. Log in to WordPress and update links inside your content with a search-and-replace plugin, replacing `example.com/new` with `example.com`.
4. Go to **Settings → Permalinks** and click **Save Changes**. This rebuilds your `.htaccess` rules.

**Other applications:** update the site URL in your app's settings or configuration file, then check `.htaccess` for any `RewriteBase /new/` line and change it to `RewriteBase /`.

## Step 4: Clear the cache and test

Ruachost servers run LiteSpeed, so pages may be cached. If you use the LiteSpeed Cache plugin, click **Purge All**, then clear your browser cache. Open `example.com` and click through a few pages, forms and images.

When everything works, you can delete the empty subfolder and the `old-site` folder.

## Related articles

- [Changing the website URL in WordPress](https://helpcenter.ruachost.com/wordpress/guides/changing-the-website-url-in-wordpress/)
- [Getting started with cPanel File Manager](https://helpcenter.ruachost.com/cpanel/files/getting-started-with-cpanel-file-manager/)
- [Configuring web page redirects in cPanel](https://helpcenter.ruachost.com/cpanel/domains/configuring-web-page-redirects-in-cpanel/)
