2
votes

I have problem to create virtual host with XAMMP. The virtual host always redirect to localhost. For example when I type mysite.local will redirect to localhost/mysite. Below is my hosts and apache config:

  1. etc/hosts

    127.0.0.1       localhost
    255.255.255.255 broadcasthost
    ::1             localhost
    fe80::1%lo0     localhost
    127.0.0.1       mysite.local
    
  2. /Applications/XAMPP/xamppfiles/etc/extra/httpd-vhosts.conf

    NameVirtualHost *:80
    # localhost
    <VirtualHost *:80>
      ServerName localhost
      DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    </VirtualHost> 
    <VirtualHost *:80>
      ServerName mysite.local
      ServerAlias mysite.local *.lancome.local
      DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/mysite"
      <Directory "/Applications/XAMPP/xamppfiles/htdocs/mysite">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride All
        Require all granted
      </Directory>
    </VirtualHost>
    
1
have .htaccess file inside /mysite folder? - Ben
yes I have .htaccess inside /mysite folder. This is magento 2 project - Randy

1 Answers

0
votes

1) D:\xampp\apache\conf\extra\httpd-vhosts.conf

<VirtualHost *:80>
 DocumentRoot "D:/xampp/htdocs/webshop_moscow/trunk"
 ServerName bos.webshop.local
 <Directory "D:/xampp/htdocs/webshop_moscow/trunk">
  # Order allow,deny
  # Allow from all
  Require all granted
 </Directory>
</VirtualHost>

2) C:\Windows\System32\drivers\etc

127.0.0.1       bos.webshop.local