divider

Error After Changing URLs in WordPress General Settings

Services: Law Firm Website Design . SEO . Internet Marketing . Law Firm Marketing Guide . Content Marketing . PPC

Recently, a client decided to purchase an alternative domain name for their existing website. They decided to log into their WordPress dashboard and start poking around. They changed the WordPress Address and Site Address under General Settings to the new domain name. Needless to say, this wasn’t a good idea. After the changes were saved, the website was no longer functioning.

wordpress-general-settings

The site wasn’t displaying and I couldn’t access the WordPress login to get to the dashboard. In order to correct the issue, I needed FTP access so I could modify the wp-config.php and functions.php file.

The following code can be used to manually define a website URL through the wp-config.php file.

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

Within seconds the website was working.

However, I was faced with another issue. When I logged in to WordPress and went back to the General Settings, the text fields were disabled.

wordpress-general-settings2

In order to edit these fields, I added the following code to the top of the functions.php file, immediately after the initial “<?php” line.

update_option('siteurl','http://www.yourdomain.com');
update_option('home','http://www.yourdomain.com');

After I uploaded the new version of the functions.php file, I removed the code that was added to the wp-config.php file.

When I logged back into WordPress, the text fields under General Settings were editable.

The last step was to remove the code that I added to the functions.php file and the issue was solved.

Check out my previous post, which will show you how to use your .htaccess file to redirect an alternative domain.


Related Posts

Ready to Take Your Website to the Next Level? Great Ideas & Results Only a Phone Call Away

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Let's get started.

5 Responses to Error After Changing URLs in WordPress General Settings

  1. Silviu
    1:00 am on May 11th, 2015

    Done this and it’s not working. Tried both wp-config and functions.php method.

  2. Error After Changing URLs in WordPress General Settings – My Blog
    11:22 pm on July 23rd, 2017

    […] Error After Changing URLs in WordPress General Settings […]

  3. ibrahim
    5:47 am on August 3rd, 2017

    tried it out….wp-config change worked perfectly, but the functions.php change did not work….received everytime an error.

  4. Jonthan
    4:36 am on December 30th, 2017

    This is actually accurate except for one point, you should have mentioned that the functions.php file to be edited is not the one in wp-include but the one found in our current themes folder.
    https://www.tipsandtricks-hq.com/how-to-change-the-url-of-a-wordpress-site-6098

  5. Santosa Sandy
    1:32 am on January 31st, 2018

    I am fixing that problem by editing the site url in the sql database as suggested here https://www.digitalocean.com/community/questions/500-internal-server-error-after-changing-wordpress-url

Leave a Reply

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

*