How Do I Fix Accidentally Changed My WordPress URL?

Fix Accidentally Changed My WordPress URL
Fix Accidentally Changed My WordPress URL

Content Quick Links

Accidentally changing your WordPress URL can cause issues such as being locked out of your WordPress dashboard or making your site inaccessible. Fortunately, you can quickly fix this issue by overriding the settings using the wp-config.php file. Here’s a step-by-step guide to help you resolve this.

Step 1: Access Your Website via FTP or cPanel

To begin, you’ll need to access your WordPress site’s files through FTP or cPanel’s file manager. Once you’re inside the file directory, locate the wp-config.php file in the root folder of your WordPress installation.

Step 2: Edit the wp-config.php File

Download or edit the wp-config.php file directly. Insert the following code just before the line that says /* That's all, stop editing! Happy publishing. */:

define('WP_HOME','http://yourdomain.com');
define('WP_SITEURL','http://yourdomain.com');

Replace http://yourdomain.com with your actual site URL. You can also use https:// if your site is secured with SSL.

Step 3: Save and Re-upload the File

After inserting the code, save the changes and re-upload the wp-config.php file if you are using FTP. This will temporarily override the URL settings, allowing you to regain access to your WordPress dashboard.

Step 4: Update the WordPress URL in Settings

Once you have access to your dashboard, go to Settings > General and correct the WordPress Address (URL) and Site Address (URL). Remove the temporary override from your wp-config.php file once the URLs are updated correctly.

Conclusion

By following these steps, you can easily fix the issue caused by accidentally changing your WordPress URL. This quick fix ensures minimal downtime and a seamless recovery.

Leave a Reply

Your email address will not be published. Required fields are marked *