8

I have built a website using drupal. Now, the base URL is http://xxx.xxx.xxx.xxx/drupal. But I want to change base URL as http://xxx.xxx.xxx.xxx How do I do?

Thanks.

  • Do you have access to add vhost in apache? If yes then one clean way is to add a virtualhost to map the directory where you have installed Drupal (including the drupal folder) to ServerName which is xx.xx.xx.xx and reload apache.. – Dipen Jun 7 '12 at 9:24
  • Hi Dipen, How to add a virtualhost to map the directory where you have installed Drupal? Thanks. – user6919 Jun 11 '12 at 3:49
11

go to yousite/sites/default and open the settings.php file and find $base_url and change it to the new value (somewhere around line 270).

NOTE : settings.php is a read-only file, you need to clear the read-only flag first to make the changes. You'll need to restart the server to update the changes.

  • 2
    I suppose there may be exotic configurations where it may be necessary, but in most cases you shouldn't have to restart the server at all - the change will go into effect immediately. – Garrett Albright Jun 7 '12 at 12:31
  • when I change the base_url to my domain name. I get much error on page. for example, "failed to load resoutce". because the resource location has been changed to "domainname/xxxx/xxx.css" (original is ip/xxxx/xxx.css) why ?? – user6919 Jun 12 '12 at 9:42
  • You need to check where the base installation of your Drupal site is. If it is at the root of the server (e.g. www), then you need to give $base_url=siteroot; else if it is in some folder inside the root of the server, then you need to have site_root/path_to_drupal_install_folder value for your $base_url – AjitS Jun 12 '12 at 10:21
  • Its not woking for me. – Eliyah Apr 25 at 3:29
5

There is a global variable called $base_url that you can set in sites/default/settings.php. Try changing its value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.