Set a temporary URL before the DNS transfer on Drupal sites

How to adjust a Drupal site to work with a temporary domain name.

1. Edit site settings

 

1
2
3
4
// Uncomment and add your IP address and 
// username to the following line.
// NO trailing slash!
$base_url = 'http://<ipaddress>/~<username>';  

 

2. Edit .htaccess

 

1
2
# Uncomment RrewriteBase and add your username.
RewriteBase /~<username>

 

3. Once the DNS transfer completes, change back to standard settings, such as by commenting out the following.

 

1
2
3
4
// NO trailing slash!
# $base_url = '/drupal';  
...
# RewriteBase /drupal