Setting the WP_SITEURL through wp-config.php

Posted OnOct 31, 2013     CategoryDevelopment     CommentsNo comment

Since WordPress 2.2, you are able to define the WP_SITEURL through wp-config.php, the address that defines where WordPress is installed. By setting it in wp-config.php, you will override the entry in the wp_options table of your Database, and will disable the URL field that appears in WordPress Dashboard » Settings.

Using this feature is not recommended, but in the instance that you should accidentally change the Database value and need your website operational in the interim, it can be handy. Feel free to read our articles on Database Backup and Restore.

In order to do this, you will need FTP/SFTP/SSH access to server.

Step 1) Connect to your server via FTP/SFTP/SSH

Step 2) Locate wp-config.php

Step 3) Open wp-config.php and add the following line, naturally replacing /path/to/wordpress with where your WordPress is installed

define( 'WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/path/to/wordpress' );

Step 4) Save your changes.

Leave a Reply

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

Send this to friend