We recently had a client who has implemented an SSL certificate for his website, but he didn’t know how to perform a proper redirection from HTTP to HTTPS, so he asked for our help.

While working on it, we noticed that the Site Address (URL) and WordPress Address (URL), found in General -> Settings, were grayed out, therefore they couldn’t be changed.

This usually happens when someone moves a WordPress site, but forgets to delete a couple of lines of code.

So, in this article, we’ll show you what file you need to edit in order to be able to change your Site Address and WordPress Address from within the General settings. It’s easy, don’t worry!

Update: If you’ve moved from HTTP to HTTPS, and you’re using WordPress MultiSite, check Craig’s comment below.

Edit your wp-config.php file

You’ll need to access your WordPress files and edit the wp-config.php file.

Backup your wp-config.php file in case something goes wrong! Just download it somewhere on your hard drive.

For our example, we’ll use cPanel. What you need to do is to:

  • Log in to cPanel and open your File Manager;

cpanel file manager

  • Select public_html;

public_html

  • On the right, find the wp-config.php file. Once you’ve found it, right-click on it and select Edit;

edit wp-config.php

  • Now search for these lines of code and delete them (if they are there, of course):

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

  • Save changes.

You’ll find your site’s URL there, of course, not “example.com”.

To quickly find them, just press Ctrl+F (Command+F on Mac) and insert a piece o code (e.g. define('WP_HOME)) and hit Enter. That will send you directly to the code.

After you delete that code, your Site Address (URL) and WordPress Address (URL) shouldn’t be grayed out anymore, and you can edit them.

If the code is not there, check the functions.php file!

Edit your functions.php file

You can edit your functions.php file through cPanel, a third party software, like FileZilla or SmartFTP, or the WordPress Editor.

We’ll use cPanel and the Editor for our examples.

Backup your functions.php file in case something goes wrong! Save it somewhere on your hard drive.

1. Through cPanel

  • Access the File Manager as in the above example;
  • Go to public_html -> wp-content -> themes -> select your theme’s folder;

wordpress themes folder

  • Once you’ve selected your theme’s folder, search for functions.php on the right, right-click on it and select Edit – the same process as above;
  • Now search for these lines of code and delete them:

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

  • Save changes.

You can always use the Ctrl+F (Command+F on Mac) command to quickly find them, as I mentioned above.

2. Through WordPress Editor

You can find this feature inside your WordPress Dashboard.

This feature might be unavailable for security reasons. Some security plugins, like iThemes Security, have an option that allows you to disable the File Editor.

In order to access this feature, you need to:

  • Go to Appearance -> Editor;

wordpress theme editor

  • Once there, search for Theme Options (functions.php) on the right and click on it;

functions.php in theme editor

  • Now search for the lines of code and delete them:

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

  • Save changes.

That’s it!

Conclusion

Be careful when you change your Site Address and/or WordPress Address, because it can affect your website. Also, be careful when you edit those files I’ve mentioned. Don’t forget to back them up!

If you’re not sure what you are doing, please ask someone with more experience to help you! Better safe than sorry, no?

If you have any thoughts to share with us, or you want to ask us something, please leave a comment!