How to Change Your WordPress Domain Name
Overview
This guide explains how to properly change your WordPress site's domain name to a new domain. Following these steps in the correct order is crucial to avoid website accessibility issues.
?? IMPORTANT: Order of Operations
You must update WordPress BEFORE changing the domain in cPanel. If you change the main domain in cPanel before updating WordPress, your site will continue redirecting to the old domain name, making it inaccessible.
Prerequisites
- Access to your hosting cPanel
- Your new domain name ready and pointed to your hosting
- Basic familiarity with cPanel interface
Accessing Your cPanel
You can access cPanel through any of these methods:
- Login to the iFastNet client portal at: https://ifastnet.com/portal/clientarea.php
- Direct cPanel access at: https://yourdomain.com/cpanel (replace with your current domain)
Need Support? Create a support ticket at: https://support.ifastnet.com/login.php
Note: First-time users will need to register an account to create tickets.
Method 1: Using phpMyAdmin (Database Method)
Step 1: Access phpMyAdmin
- Login to your cPanel
- Scroll down to the Databases section
- Click on phpMyAdmin
Step 2: Select Your WordPress Database
- In the left sidebar, click on your WordPress database name
- Look for a table named
wp_options (the prefix might be different, like wp123_options)
Step 3: Edit Site URLs
- Click on the
wp_options table
- Look for two rows with these
option_name values:
- For each row:
- Click the Edit button (pencil icon)
- Change the
option_value from your old domain to your new domain
- Example: Change
https://olddomain.com to https://newdomain.com
- Click Go to save changes
Step 4: Verify Changes
- Both
siteurl and home entries should now show your new domain
- Close phpMyAdmin
Method 2: Using wp-config.php (File Manager Method)
Step 1: Access File Manager
- In cPanel, scroll to the Files section
- Click on File Manager
- Navigate to your website's root directory (usually
public_html)
Step 2: Edit wp-config.php
- Locate the
wp-config.php file
- Right-click and select Edit
- Find the line that says
/* That's all, stop editing! Happy publishing. */
- Above this line, add these two lines:
define('WP_HOME','https://yournewdomain.com');
define('WP_SITEURL','https://yournewdomain.com');
Replace yournewdomain.com with your actual new domain
Step 3: Save the File
- Click Save Changes
- Close the file editor
After WordPress is Updated
Configure Your New Domain in cPanel
You have two options for setting up your new domain:
Option 1: Add New Domain (Recommended)
- In cPanel, go to Domains or Addon Domains
- Click Create A New Domain
- Enter your new domain name
- Set the Document Root to the same location as your existing domain (usually
public_html)
- Click Submit
This option allows both domains to work simultaneously during the transition period.
Option 2: Change Main cPanel Domain (Optional)
Important: Changing the main cPanel domain requires support assistance and is optional.
- Contact iFastNet support to request the main domain change
- Create a support ticket at: https://support.ifastnet.com/login.php
- In your ticket, specify:
- Your current main domain
- The new domain you want to set as the main domain
- Confirm that you have already updated WordPress to use the new domain
- Wait for support to complete the domain change before proceeding
Note: Option 1 is typically sufficient for most users and allows for easier management.
Test Your Website
- Clear your browser cache
- Visit your new domain
- Check that all pages load correctly
- Verify admin access at
https://yournewdomain.com/wp-admin
Troubleshooting
If Your Site Still Redirects to the Old Domain:
- Double-check that you updated WordPress BEFORE changing the cPanel domain
- Verify both database entries or wp-config.php additions are correct
- Clear your browser cache and cookies
- Check if there are any caching plugins that need to be cleared
If You Can't Access Your Admin Area:
- Use Method 2 (wp-config.php) as it often resolves access issues
- Ensure the URLs in wp-config.php exactly match your new domain (including https://)
Additional WordPress Settings:
After the domain change, you may need to:
- Update any hardcoded URLs in your content
- Update widget settings that reference the old domain
- Regenerate permalinks in Settings > Permalinks
Summary
- First: Update WordPress using either Method 1 (database) or Method 2 (wp-config.php)
- Second: Change the main domain in cPanel
- Finally: Test your website and update any remaining references to the old domain
Following this order ensures your WordPress site will be accessible on the new domain without redirect issues.