Using Drupal before DNS changes

Replace the Domain with the Temporary URL

First, you must understand that Drupal uses your .htaccess file to control the domain name rewriting. Since your domain name is not associated with your website yet, we will need a work around. At most web hosts,  you have a temporary URL you can use to view your website before the domain name is fully propagated. It is based on your server’s IP address and your user name. Here is an example:

http://SERVERIP/~username

All you need to do to make Drupal work with this temporary URL is edit a two files. In your public_html folder, go to sites/default/ and open up the file named settings.php. Look for the line that says:
#$base_url

Un-comment the line by removing the pound (#) sign in front of it and then add your temporary URL (http://SERVERIP/~username) as the value. So then it should look like this:
$base_url = 'http://SERVERIP/~username';

Once you have made the changes correctly, save the changes to the file.

 

Update the .htaccess File

Now, you will need to make the changes to the .htaccess file for your installation of Drupal. Make sure you go to the root folder for the installation (such as, if it is inside your public_html folder, go within that location) and edit your .htaccess file.

Look for the line that has:
#RewriteBase /drupal

You want to un-comment this (by removing the # in front). Then, remove “drupal” from that line and replace it with the username of the temporary URL. So using the same example as we did before, this would make it:

RewriteBase /~username

Save your changes you have made to the .htaccess file, and now the rewrite function of the Drupal script will work.

Once you get your domain name associated with your hosting account, you will want to comment out the two changes you have made to switch things back to normal. If you do not, then your Drupal installation will continue to use the temporary URL not your real domain name.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Migrating your Drupal site to your new web hosting account

Here are the detailed steps how to successfully move a complete Drupal installation from one...

ini_set disabled and causes errors on Drupal site - How to fix

For security reasons ini_set has been disabled on the server.  Some Drupal sites will see...

Drupal security steps

This article will explain in detail the steps that are recommended to secure your Drupal website.