Force WordPress site URL

Last Revised: October 2, 2021

One of the most common mistakes of an admin user in the WordPress admin panel is to change the URLs that appear on the first setup screen: the addresses of the main page of the site.

To prevent anyone, deliberately or mistakenly, from making a change in the addresses and therefore the site stops working, it is best to block those addresses from the configuration file [wp-config.php]. To do this we will add two lines:

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

With this you get the URLs blocked from the panel and you can not produce unwanted changes that prevent access to the site.


Seguir con Seguridad para WordPress


About this document

This document is regulated by the EUPL v1.2 license, published in WP SysAdmin and created by Javier Casares. Please, if you use this content in your website, your presentation or any material you distribute, remember to mention this site or its author, and having to put the material you create under EUPL license.