How to Change Your WordPress Domain Name for cPanel Hosting

This guide explains how to properly change your WordPress website from one domain name to another on cPanel hosting.

Following the steps in the correct order is very important to avoid website accessibility issues.

You must update your WordPress website before changing the domain configuration in cPanel.

If you change the main domain in cPanel first, WordPress may continue redirecting visitors to the old domain name, which can make your website inaccessible, making

Before You Start

Make sure you have the following:

  • Access to your hosting cPanel
  • Your new domain name already registered and pointed to your hosting
  • Basic familiarity with the cPanel interface

How to Access cPanel

You can access cPanel using one of the following methods:

  • Log in through the Client Area: https://my.libyanspider.com
  • Direct cPanel login: https://yourdomain.com/cpanel

Replace yourdomain.com with your current active domain name.

Step 1: Update WordPress to Use the New Domain

You can do this using one of the following methods.

Method 1: Update the Domain from phpMyAdmin

Access phpMyAdmin

  1. Log in to cPanel.
  2. Scroll to the Databases section.
  3. Click phpMyAdmin.

Select Your WordPress Database

  1. In the left sidebar, select your WordPress database.
  2. Locate the table named wp_options.

Note: Your table prefix may be different, such as wp123_options.

Edit the Website URLs

  1. Open the wp_options table.
  2. Look for the rows with the following option_name values:
    • siteurl
    • home
  3. For each row:
    • Click Edit
    • Change the option_value from the old domain to the new domain

Example:

  • Old: https://olddomain.com
  • New: https://newdomain.com
  1. Click Go to save the changes.

Verify the Changes

Confirm that both siteurl and home now contain the new domain name.

Method 2: Update the Domain from wp-config.php

This method is useful when you cannot access the WordPress admin area or want to force WordPress to use the new domain.

Access File Manager

  1. Log in to cPanel.
  2. Scroll to the Files section.
  3. Click File Manager.
  4. Open your website’s root folder, usually public_html.

Edit the wp-config.php File

  1. Locate the file named wp-config.php.
  2. Right-click it and choose Edit.
  3. Find this line:
/* That's all, stop editing! Happy publishing. */
  1. Add the following lines above that line:
define('WP_HOME','https://yournewdomain.com');
define('WP_SITEURL','https://yournewdomain.com');
  1. Replace yournewdomain.com with your actual new domain name.

Save the File

  1. Click Save Changes.
  2. Close the file editor.

Step 2: Configure the New Domain in cPanel

After updating WordPress, configure the new domain in cPanel.

You have two options.

Option 1: Add the New Domain in cPanel

This is the recommended option.

  1. In cPanel, go to Domains.
  2. Click Create A New Domain.
  3. Enter your new domain name.
  4. Set the Document Root to the same location used by your current website, usually public_html.
  5. Click Submit.

This method allows both the old and new domains to work during the transition period.

Option 2: Change the Main cPanel Domain

This step is optional and may require assistance from support.

If you want to replace the main cPanel domain with the new one, open a support ticket through the Client Area and provide the following:

  • Your current main domain
  • The new domain you want to use
  • Confirmation that WordPress has already been updated to the new domain

Client Area: https://my.libyanspider.com

In most cases, adding the new domain is enough and is easier to manage.

Step 3: Test Your Website

After completing the changes:

  1. Clear your browser cache.
  2. Visit your new domain name.
  3. Check that the website loads correctly.
  4. Test the WordPress admin area at:
https://yournewdomain.com/wp-admin

Troubleshooting

If your website still redirects to the old domain:

The Website Still Redirects to the Old Domain

  • Make sure you updated WordPress before making domain changes in cPanel
  • Verify that both siteurl and home were updated correctly
  • If using wp-config.php, confirm the domain entries are correct and include https://
  • Clear your browser cache and cookies
  • Clear any WordPress caching plugins if enabled

You Cannot Access the WordPress Admin Area

If you are unable to log in to /wp-admin:

  • Use the wp-config.php method to force WordPress to use the new domain
  • Double-check the domain format for accuracy
  • Make sure the new domain is correctly pointed to your hosting account

After changing the domain, you may still need to:

  • Update hardcoded links inside pages or posts
  • Update widget settings that contain the old domain
  • Regenerate permalinks from Settings > Permalinks in WordPress

Summary

To safely change your WordPress domain name on cPanel hosting:

  1. First: Update WordPress to use the new domain through phpMyAdmin or wp-config.php
  2. Second: Add the new domain in cPanel, or request a main domain change if needed
  3. Finally: Test the website and update any remaining references to the old domain

Following this order helps prevent redirect problems and keeps your website accessible during the transition.

Share this:
FacebookXWhatsAppTelegramLinkedInGmailCopy Link
Updated on April 11, 2026
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support