skip to Main Content

Hi I have browsed all the resources, but still seems can’t find the solution.

I have XAMPP Control Panel v 3.2.4 (compiled Jun 5th 2019) installed on my computer, it is installed in d:xampp. I want to create a Virtual host, so that I can correctly use various global PATH variables.

I followed instructions closely.

This is from my D:xamppapacheconfextrahttpd-vhosts.conf:

    <VirtualHost *:80>
     ServerName localhost
     DocumentRoot "D:xampphtdocs"
     <Directory "D:xampphtdocs">
         DirectoryIndex index.php
     </Directory>
 </VirtualHost>

<VirtualHost *:80>
     ServerName ikeen.localhost
     DocumentRoot "D:xampphtdocsikeen"
     SetEnv APPLICATION_ENV "development"
     <Directory "D:xampphtdocsikeen">
         DirectoryIndex index.php
         AllowOverride All
         Order allow,deny
         Allow from all        
     </Directory>
 </VirtualHost>

I have added following lines to the end of httpd.conf:

<Directory />
    AllowOverride none
    Require all granted
</Directory>

I have the following line in my hosts file in windows:

127.0.0.1      ikeen.localhost

This is the structure of my site directory

enter image description here

In order to avoid cache I open URL in the incognito mode and from different browsers. I always get redirect to dashboard – https://ikeen.localhost/dashboard/, it opens the standard “Welcome to XAMPP for Windows 7.4.3”

I have heard that it has something to do with https, as I’m always transferred to https URL even if I try to use http. I’ve looked at httpd-ssl.conf, but I don’t know what to do there. Any ideas?

3

Answers


  1. Chosen as BEST ANSWER

    Finally! For everyone who is looking for the solution do the following:

    My desired site is located at D:xampphtdocsikeen.

    1) Add this to your httpd-vhosts.conf:

    <VirtualHost *:80>
         ServerName localhost
         DocumentRoot "D:xampphtdocs"
         <Directory "D:xampphtdocs">
             DirectoryIndex index.php
         </Directory>
     </VirtualHost>
    
    <VirtualHost *:80>
         ServerName ikeen.localhost
         DocumentRoot "D:xampphtdocsikeen"
         SetEnv APPLICATION_ENV "development"
         <Directory "D:xampphtdocsikeen">
             DirectoryIndex index.php
             AllowOverride All
             Order allow,deny
             Allow from all        
         </Directory>
     </VirtualHost>
    

    2) Add this to the end of httpd.conf:

    <Directory />
        AllowOverride none
        Require all granted
    </Directory>
    

    3) Add this line to your hosts file in Windows directory

    127.0.0.1      ikeen.localhost
    

    4) Finally, this is the step that is missing from all the solutions. Add this to your httpd-ssl.conf, after the same section for your localhost (usually www.example.com), change example.com to your local settings for localhost, so that the whole section looks smth like this

    <VirtualHost _default_:443>
    
    #   General setup for the virtual host
    DocumentRoot "D:/xampp/htdocs"
    #ServerName www.example.com:443
    ServerName localhost
    ServerAdmin [email protected]
    ErrorLog "D:/xampp/apache/logs/error.log"
    TransferLog "D:/xampp/apache/logs/access.log"
    
    #   General setup for the ikeen host
    DocumentRoot "D:/xampp/htdocs/ikeen"
    #ServerName www.example.com:443
    ServerName ikeen.localhost
    ServerAdmin [email protected]
    ErrorLog "D:/xampp/apache/logs/error.log"
    TransferLog "D:/xampp/apache/logs/access.log"
    

  2. I had the same issue. Problem was solved by removing the standard virtual host entry and i wasn’t redirected to the root directory.

    Just remove these lines of code:

    <VirtualHost *:80>
         ServerName localhost
         DocumentRoot "D:xampphtdocs"
         <Directory "D:xampphtdocs">
             DirectoryIndex index.php
         </Directory>
     </VirtualHost>
    
    Login or Signup to reply.
  3. If the case does not work, maybe change httpd-ssl.conf

    My 3 sites worked, localhost, test1.com, test2.com

    #
    <VirtualHost _default_:443>
    DocumentRoot "c:/xampp/htdocs"
    ServerName localhost
    ServerAdmin [email protected]
    ErrorLog "c:/xampp/apache/logs/error.log"
    TransferLog "c:/xampp/apache/logs/access.log"
    
    ...
    </VirtualHost>
    
    #test1
    <VirtualHost _default_:443>
    DocumentRoot "c:/xampp/htdocs/test1"
    ServerName test1.com
    ServerAdmin [email protected]
    ErrorLog "c:/xampp/apache/logs/error.log"
    TransferLog "c:/xampp/apache/logs/access.log"
    
    ...
    </VirtualHost>
    
    #test2
    <VirtualHost _default_:443>
    DocumentRoot "c:/xampp/htdocs/test2"
    ServerName test1.com
    ServerAdmin [email protected]
    ErrorLog "c:/xampp/apache/logs/error.log"
    TransferLog "c:/xampp/apache/logs/access.log"
    
    ...
    </VirtualHost>   
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search