Setup short and easy to remember URL for multi-site in Windows local PC

When developing on multi-site in our local development environment we wanted a short and easy to remember URL for each site. We will take a look on how to setup http://webfoobar and http://myotherwebsite address for our sites. The following instructions are for Windows with XAMPP web server solution stack package.

  1. First we will edit the C:\Windows\System32\drivers\etc\hosts file to register the URL name of each site we are developing in XAMPP and append the following codes:
      
    127.0.0.1       webfoobar
    127.0.0.1       myotherwebsite
      
    
  2. Append the following codes in C:\xampp\apache\conf\httpd.conf file:
      
    <Directory "C:/xampp/htdocs/drupalsites">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
      
    
  3. Lastly, append the following codes in C:\xampp\apache\conf\extra\httpd-vhosts.conf file:
      
    <VirtualHost *:80>
       DocumentRoot "C:\xampp\htdocs\drupalsites"
       ServerName webfoobar
    </VirtualHost>
    
    <VirtualHost *:80>
       DocumentRoot "C:\xampp\htdocs\drupalsites"
       ServerName myotherwebsite
    </VirtualHost>
      
    
  4. Restart your Apache web server and you can now access http://webfoobar and http://myotherwebsite in your browser.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.