Virtual host in xampp

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Virtual host in xampp

Postby Markb » 31. July 2013 15:32

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
Markb
 
Posts: 2
Joined: 31. July 2013 15:11
XAMPP Version: 5.5.19
Operating System: Win 7

Re: Virtual host in xampp

Postby Altrea » 31. July 2013 15:44

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.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6609
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64

Re: Virtual host in xampp

Postby Markb » 31. July 2013 16:17

Thanks Altrea,
yes, an errant .htaccess rule was causing the issue....
thanks
Markb
 
Posts: 2
Joined: 31. July 2013 15:11
XAMPP Version: 5.5.19
Operating System: Win 7

Re: Virtual host in xampp

Postby Altrea » 31. July 2013 16:18

You are welcome 8)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6609
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 71 guests