I used Drupal multisite approach. When I go to mydomain.com the default site is loaded and if I deleted sites/default/settings.php file, it is creating again.

How do I disable the default site so that, not even the installation page is shown?

  • Set redirect rule for main website Jun 7, 2016 at 11:40
  • @VishalPatil What do you mean, redirect to what? I don't want to have a default site at all.
    – macurie
    Jun 7, 2016 at 11:40
  • You can redirect to some other website which is active in the same multisite setup instead of disabling the default. Jun 7, 2016 at 11:42
  • @VishalPatil Do I have to have a default? Can't it just 404 or something if the requested domain/site doesn't exist?
    – macurie
    Jun 7, 2016 at 11:43

3 Answers 3


Create a directory under the sites directory besides default with the exact name as your domain and place the settings.php file in it. You can delete the default/settings.php after this.

  • Don't I need to keep the default.settings.php?
    – macurie
    Jun 7, 2016 at 11:59
  • @macurie The file is just a reference and is not executed. It is copied automatically to settings.php if the server has write permissions to the default directory and when there is no site specific directory. No harm in keeping it as is.
    – AjitS
    Jun 7, 2016 at 12:04
  • If I delete sites/default/settings.php and go to http://myip I get redirected to http://myip/install.php?profile=myprofile&locale=en. How do I avoid this?
    – macurie
    Jun 7, 2016 at 12:09
  • @macurie As mentioned in the answer, you have to create the a directory with the same name as the domain inside the sites directory. Create a directory with the domain name (say mydomain.com) and place the settings.php in it (sites/mydomain.com/settings.php1).
    – AjitS
    Jun 7, 2016 at 12:20
  • I don't think that's what he wants since it's a multisite and any random domain could potentially trigger the install.php script. He or rather you @macurie need to perform a minimal install with sqlite which will generate a settings.php so the install.php won't appear any more. You have to show something. Either configure the webserver to only allow specific domains or install a default site
    – user26869
    Jun 7, 2016 at 12:30

You can follw these documents for better understanding of multisite approach in Drupal.
link1 Link2

If possible you can mention in your question, which steps you have followed also.

  • This doesn't seem helpful. Why do I need to create Apache virtualhosts for each site?
    – macurie
    Jun 7, 2016 at 12:13
  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – mpdonadio
    Jun 7, 2016 at 19:04

You can just delete everything in default/settings.php and write whatever logic you like in settings.php (print message, redirect, just exit, etc ....) and don't forget exit() the the script after you finish.

Also you can choose one of the sites you have to act as a default site just replace the default directory with it.

@see conf_path() for the code implementation of Drupal multi-site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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