Getting started with WordPress via your Temporary Webpage URL

Your WordPress site is automatically configured to work with your domain and will not be usable via the Temporary Webpage URL.  However you can get started immediately by adding a small configuration change to WordPress.

You'll need to edit your wp-config.php file.

The wp-config.php file is located in your webroot (public_html)  You can edit this file by logging into your cPanel and choosing File Manager, just right-click it and choose code edit.  You can of course modify your files using your FTP account, or by setting up SSH through cPanel if that suits you.

Near the top of the file (but after the opening PHP tag: <?php ) you have to add some extra lines of code.

Option 1:
This is a temporary solution, which will have to be removed to work with your domain name:
define( 'WP_HOME', 'http://websamford.com/~username' );
define( 'WP_SITEURL', 'http://websamford.com/~username' );
Where the URL entered is your Temporary Webpage URL.

Option 2: 

Alternatively we've devised this dynamic solution which will continue to work with your domain name even if you choose not to remove it:

$matches = array();
preg_match( '/[^\~]+\~[^\/]+\//i', $_SERVER['SCRIPT_URI'], $matches );
if ($matches[0]) {
  define( 'WP_HOME', $matches[0] );
  define( 'WP_SITEURL', WP_HOME . '/' );
}


Save your wp-config.php file and WordPress will now work with the Temporary Webpage URL.

Was this answer helpful?

 Print this Article