This works for a couple of subdomains/sites only. If you need to have a load of sites or other settings this is not for you. On the other hand this method needs no web server configuration.
- In your systems hosts file (Windows: In your favourite text editor open
%SYSTEMROOT%\system32\drivers\etc\hostsand on Linux it’s/etc/hosts. - Find the line defining 127.0.0.1, i.e. your local horst, erm localhost
and append sitename1.localhostto the end of the line. do so for every site name you need. - Go to your apaches/webservers documents folder holding your drupal installation. Say it’s
htdocs/drupalthan you need folder sites. There should be at least two folders called all and default. Copy default and name itsitename1.localhost, i.e. excactly the string you added to your hosts file (again you need to replacesitename1by your site’s name but do include the dot!). - In your web browser type
sitename1.localhost/drupalto test if drupal shows up at all (meaning your OS resolves your “domain name” correctly) and if it shows your old content (meaning it works).
Now you have two options to actually set up your “new site”: Either edit the settings.php that should be in the new folder to use a diferent data base (that should be well-stocked with drupal data) or just install a fresh drupal site. You achieve the later by doing:
- Delete
settings.php. That should leave you with a file nameddefault.settings.php. - Point your browser to
sitename1.localhost/drupal/install.phpand do everything like you did with the first install but use a diferent database (or the same but different database prefix). - Done.
Resources
- settings.php







