Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i would like to configure multiple web site under apache. I copy my website files into


How do i configure apache to load different site when user write:




share|improve this question
up vote 2 down vote accepted

You would need to set up an Apache VirtualHost. In Ubuntu these are located at /etc/apache2/sites-available/<my site>

Your virtual host in this case could look something like this:

<VirtualHost *:80>
    ServerName <myserver>
    DocumentRoot /var/www # Point Apache to your web directory

    <Directory />
        Options -Indexes # Don't allow Apache to show a listing of the directory if someone navigates to http://myserver/
        AllowOverride All # Allow .htaccess files in each site directory to be read

This is the most simple set up that should get you up and running. Once you create this virtual host file in /etc/apache2/sites-available, run sudo a2ensite <mysite> to enable the site and then restart apache with sudo service apache2 restart

Navigate to http://myserver/ and you should get an access denied page, but navigate to http://myserver/site1 and you should see the correct site.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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