Multiple Virtual Host in XAMPP

23-10-2016

Multiple virtual host configuration in XAMPP

Step1: Open httpd.conf file and paste following configuration at the end of the file.

<VirtualHost *:8090>
    ServerName domain.tld
    ServerAlias www.domain.tld

    DocumentRoot C:/xampp/htdocs/symfony/urunTakipSistemi/web
    <Directory C:/xampp/htdocs/symfony/urunTakipSistemi/web>
        AllowOverride None
        Order Allow,Deny
        Allow from All

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ app.php [QSA,L]
        </IfModule>
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeeScript assets
    # <Directory /var/www/project>
    #     Options FollowSymlinks
    # </Directory>

    # optionally disable the RewriteEngine for the asset directories
    # which will allow apache to simply reply with a 404 when files are
    # not found instead of passing the request into the full symfony stack
    <Directory C:/xampp/htdocs/symfony/urunTakipSistemi/web/bundles>
        <IfModule mod_rewrite.c>
            RewriteEngine Off
        </IfModule>
    </Directory>
  
</VirtualHost>
<VirtualHost *:8090>
    ServerName nwsa.com
    ServerAlias www.nwsa.com

    DocumentRoot C:/xampp/htdocs/nwsa
    <Directory C:/xampp/htdocs/nwsa>
        AllowOverride All
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>

Step 2: Open Windows/System32/etc/hosts file and add following line:

 127.0.0.1 domain.tld
 127.0.0.1  www.domain.tld
 127.0.0.1  nwsa.com
 127.0.0.1  www.nwsa.com

© 2019 All rights reserved. Codesenior.COM