# Changing the domain in WordPress

> Move your WordPress site to a new domain name by updating its URLs with the dashboard, WP-CLI or phpMyAdmin.

Source: https://helpcenter.ruachost.com/wordpress/guides/changing-the-domain-in-wordpress/

Sometimes you may need to change the domain name of your WordPress site—for example, when migrating to a new domain or rebranding. On **ruachost.com**, you can update your WordPress domain settings using the dashboard, WP‑CLI, or phpMyAdmin.

## Why Change the Domain?

- Rebrand your site with a new domain name.
- Migrate to a different hosting environment.
- Improve SEO with a more relevant domain.

## Step 1: Back Up Your Site

Before making any changes, always back up your WordPress files and database. This ensures you can restore your site if anything goes wrong.

## Step 2: Change Domain Settings

### Method 1: Using WordPress Admin Dashboard

1. **Log in to WordPress** as an administrator.
2. Go to **Settings → General**.
3. Update the following fields:

   - **WordPress Address (URL)** → Enter the new domain.
   - **Site Address (URL)** → Enter the new domain. ⚠️ If your site has SSL, use `https://` instead of `http://`.
4. Click **Save Changes**.

### Method 2: Using WP‑CLI (Command Line)

1. Log in to your hosting account via **SSH**.
2. Navigate to your WordPress installation directory.
3. Run the following command (replace with your domains):

   ```bash
   wp search-replace 'old.example.com' 'new.example.com'
   ```

✅ This updates all instances of the old domain in the database.

### Method 3: Using phpMyAdmin

1. Log in to **cPanel** (or your hosting control panel).
2. Open **phpMyAdmin** → Select your WordPress database.
3. Locate the **wp_options** table.
4. Update the values for:

   - `siteurl`
   - `home`
5. Save changes.

## Step 3: Test Your Site

- Visit your site with the new domain.
- Check for broken links or hard‑coded URLs.
- Set up **redirects** from the old domain to the new one to preserve SEO.

## Important Notes

- DNS propagation may take up to **24 hours**.
- Always ensure the new domain points to your hosting server before updating WordPress.
- Consider updating your **permalink structure** and regenerating your sitemap.
