How to Change WordPress Site URL via cPanel Database
How to Change WordPress Site URL via cPanel Database
Why Change Your WordPress Site URL via Database?
Sometimes, you might need to change your WordPress site URL if you have moved your website to a new domain, fixed a broken URL, or updated your site from HTTP to HTTPS. If you cannot access your WordPress dashboard, changing the URL via the database is a quick and effective solution.
Important: Backup Your Database First
Before making any changes, always create a full backup of your WordPress database to avoid data loss in case of any errors.
Step 1: Log in to cPanel
- Go to your hosting provider’s cPanel login page.
- Enter your username and password to access the cPanel dashboard.
Step 2: Open phpMyAdmin
- In the cPanel dashboard, scroll down to the Databases section.
- Click on phpMyAdmin to open the database management tool.
Step 3: Select Your WordPress Database
- In phpMyAdmin, locate your WordPress database from the list on the left sidebar. If you are unsure of the database name, check the
wp-config.php
file in your WordPress root directory for theDB_NAME
value. - Click on the database name to view its tables.
Step 4: Edit the siteurl and home URL in wp_options Table
- Find and click on the table named
wp_options
. (Note: The prefixwp_
may be different if customized during installation.) - Look for the rows with the option_name siteurl and home. They are usually within the first few rows.
- Click the Edit button next to each to modify their values.
- Replace the existing URL with your new site URL (e.g.,
https://www.newdomain.com
). - Click Go or Save to apply the changes.
Step 5: Clear Your Browser and WordPress Cache
After updating the URLs, clear your browser cache to avoid loading old data. If you use caching plugins in WordPress, clear those caches too.
Step 6: Test Your Website
Visit your website using the new URL to ensure everything loads correctly. Login to your WordPress admin dashboard using the new URL.
Troubleshooting Tips
- If you encounter login issues, clear cookies and try again.
- Check your
wp-config.php
file for any hardcoded URLs. - If the site still points to the old URL, verify that your domain DNS settings are updated correctly.
Conclusion
Changing your WordPress site URL via the cPanel database is an effective way to fix URL-related issues, especially when you cannot access the WordPress admin dashboard. Always remember to backup your database before making changes and proceed carefully.