Page 1 of 1

Virtual host in xampp

PostPosted: 31. July 2013 15:32
by Markb
I´ve been trying to get a virtual host working in xampp so that I can test a Wordpress site located in a folder outside my document root. I have successfully used a myconf folder to store conf files for apache to include and that has never caused any issue but this new folder has the installation in a subfolder. The basics of my setup are
c:/xampp - Server
c:/_Projects/proj.secretsinspired/secrets

I´ve followed every tip, advice I could get my hands on but the virtual host continues to redirect to localhost/xampp. I´ve tried creating a symbolic link in my xampp/htdocs folder to no effect. At the moment this is what I have... Can anyone suggest what is going on here?

1. I´ve changed my host file to :
Code: Select all
# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
::1             localhost
127.0.0.1     proj.secrets


2. In my httpd-vhosts.conf I´ve added the following;
Code: Select all
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#

<VirtualHost *:80>
    ServerName localhost
    ServerAdmin admin@localhost.com
    DocumentRoot "C:/xampp/htdocs"
#    ##ErrorLog "logs/dummy-host2.example.com-error.log"
#    ##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerName proj.secrets
    ServerAlias www.proj.secrets
    DocumentRoot "C:/_Projects/proj.secrets/inspired-by-secrets/"
    ServerAdmin admin@localhost.com
    <Directory "C:/_Projects/proj.secrets/inspired-by-secrets/">
             Options Indexes FollowSymLinks MultiViews
             AllowOverride all
             Order allow,deny
             Allow from all
             Require all granted
   </Directory>
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
</VirtualHost>


3. In my httpd.conf I´ve set an include for both the vhosts and myconf files
Code: Select all
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Include conf/myconf

Re: Virtual host in xampp

PostPosted: 31. July 2013 15:44
by Altrea
Your configuration is working on my test environment, so i guess that there is a redirect / rewrite in your not shown configuration or .htaccess file that points to the wrong destination.

Re: Virtual host in xampp

PostPosted: 31. July 2013 16:17
by Markb
Thanks Altrea,
yes, an errant .htaccess rule was causing the issue....
thanks

Re: Virtual host in xampp

PostPosted: 31. July 2013 16:18
by Altrea
You are welcome 8)