Hostwinds Tutorials

Search results for:


Table of Contents


Modify WordPress Site URL
Option 1: Edit wp-config.php
Option 2: Modify The WordPress database

Temporarily Change WordPress URL (siteurl and home)

Tags: WordPress 

Modify WordPress Site URL
Option 1: Edit wp-config.php
Option 2: Modify The WordPress database

So you've just bought hosting and a domain name and want to set up a WordPress site while waiting for the domain registration or DNS propagation. WordPress relies on the domain name resolving to your web hosting account's IP address to function properly, so if the domain isn't pointing to the WordPress install, we have to tell WordPress to use the dedicated IP address of the hosting package or VPS server until things work right with the domain.

Modify WordPress Site URL

Once WordPress is installed, you have a few options for modifying the site URL. Let's get started.

Option 1: Edit wp-config.php

The root directory of your WordPress installation (public_html on a hosting package (or /var/www/HTML on a VPS, depending on OS and setup) will be the wp-config.php file.

In cPanel, use the File Manager to navigate to public_html (or the subdomain WordPress is installed), click the wp-config.php file, and click Edit in the file manager.

– or –

In ssh, cd to /var/www/HTML or to the document root where WordPress is installed and Edit, this file in your favorite Text Editor. For example, type nano wp-config.php  to open this file so that you can make some edits.

Add these two lines to the config, the options will not already be there:

define( 'WP_HOME', 'http://192.168.2.5/' );
define( 'WP_SITEURL', 'http://192.168.2.5/' );

Save, and exit, and refresh the WordPress page

Option 2: Modify The WordPress database

On a cPanel-based hosting, you can easily edit the WordPress database with phpMyAdmin

Instead of navigating to the user's table, though, you'll need to navigate to the _options table in phpMyAdmin

Then find the site URL and home fields (they're typically near the top but may not be) and edit each of them from "http://yourdomainname.com/" to "http://192.168.2.5"

Click edit to the left of the field and change the domain to the IP address (but leave the http[s]:// and any trailing / or /wp)

Then click Go when finished.
Repeat this for the 'home' row in this table.

Once this is done, you can exit phpMyAdmin and refresh your WordPress page(s).

– or –

On a VPS, you would have to use MySQL from the command line. Here is an example below:

# mysql

show databases;
use wordpressdatabase;
update wp_options set siteurl = REPLACE(siteurl,"http://yourdomainname.com/","http://192.168.2.5/");
update wp_options set home = REPLACE(home,"http://yourdomainname.com/","http://192.168.2.5/");
quit;

Written by Hostwinds Team  /  December 14, 2018