How to configure Drupal to use the server URL instead of my domain name?

Depending on your Drupal application version there are different steps that you should go through in order to configure your website with the server URL:

Drupal 6.x and 7.x

  • Edit the .htaccess file of your application:

This file is located in the folder where Drupal is installed. You can edit the .htaccess file using File Manager in cPanel, or via FTP. The line you should modify is:

If your Drupal is installed in the main public_html folder, you should change the above line to:

Where cPanel_username is your actual cPanel user.

If your Drupal is installed in a subfolder, for example drupal/, you should change the above line to:

  • The second file is settings.php:

This file can be found in the installation directory of your Drupal website, under sites/default/settings.php. Open the file and modify the $base_url line:



If you are a SiteGround customer you can find your cPanel and server details in your User Area -> My Accounts -> Information & Settings.

Drupal 8.x websites

  • Edit the settings.php file located under:


There you will see the following lines:

Here you should change yourdomain\.com with the server where your account is hosted.

For example, if your account is hosted on the server the lines in the settings.php should be altered as follows:

  • Add the respective RewriteBase in the .htaccess file of your Drupal application.

In case the Drupal application is installed under the public_html folder, you should add the following in the .htaccess file:

Make sure that you substitute cPanel_username with your actual cPanel user.

You find this article useful? Click here to learn more about SiteGround web hosting experts and what else we can do for you!