access-drupal-from-temp-url

Before publishing a site over the Internet, we prefer to ensure that everything over the website is just how we expected. In such a case having to access our Drupal based website on a cPanel server with a temporary URL can come-in handy.

For example:

http://yourserverip/~username/your-test-website
Note: For explanation ‘your-test-website’ is where the Drupal site is configured. Paths may vary according to the configuration.

Following the steps below should help you set-up a site over a temporary URL:

Step 1: Find the file /public_html/sites/default/settings.php on the server.

Step 2: Find the setting “$base_url = “.
Un-comment the line and replace with the below:

$base_url = 'http://serverip/~test';

Step 3: You must now configure the .htaccess for appropriate redirection.

Step 4: Open .htaccess file in the drupal directory. (/public_html/your-test-website/.htaccess)

Find the line which says ‘RewriteBase /

Un-comment the line and replace it with the following:

RewriteBase /~username

Step 5: Save the file.

Now try accessing your domain using the temporary URL:

http://yourserverip/~username/your-test-website

By doing this, you can test your website without publishing over the web. Once you are assured about its functionality, you may move the entire directory under the main domain to make the site publicly accessible.