Mobile app version of vmapp.org
Login or Join
Correia994

: How to forward real .com domain to XAMPP subfolder using httpd-vhosts.conf? I am trying to emulate some Google Apps app installation functionality and in order to effectively debug it, I need

@Correia994

Posted in: #Localhost #Server #Xampp

I am trying to emulate some Google Apps app installation functionality and in order to effectively debug it, I need it running on my local Windows 7 machine (using XAMPP).

I am behind a router and I've forwarded port 80 to my local IP. When I visit my real IP in the browser I can browse the XAMPP htdocs folder, but when I visit the domain I also browse the htdocs folder. Whereas I need to browse a specific subfolder when I visit the domain.

I've played a bit with httpd-vhosts.conf and here's what I got right now:

<VirtualHost mydomain.info>
ServerAdmin contact@mydomain.info
DocumentRoot "C:/xampp/htdocs/mydomain/subfolder"
ServerName mydomain.info
ServerAlias mydomain.info
ErrorLog "logs/mydomain.info-error.log"
CustomLog "logs/mydomain.info-access.log" combined
</VirtualHost>

<VirtualHost localhost>
ServerAdmin postmaster@dummy-host.localhost
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" combined
</VirtualHost>


As you can see, the first rule should have pointed all requests to mydomain.info to c:/xampp/htdocs/mydomain/subfolder, but instead it forwards them to just c:/xampp/htdocs.

Edit: I forgot to mention that I use a free DNS service, to whose nameservers I have pointed the domain. Then in that service's DNS management I've added a A record for the domain with value that looks like this (IP is an example): mydomain.info A 85.201.133.59 and TXT record, required for Google Apps verification: mydomain.info TXT google-site-verification=7rgvD...... However, I doubt this is the problematic thing, since the domain resolves to my local machine as I have mentioned. It just doesn't resolve to the correct folder.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Correia994

1 Comments

Sorted by latest first Latest Oldest Best

 

@Annie201

I think you'll find the problem is your VirtualHost declaration.

Replace:

<VirtualHost mydomain.info>
<VirtualHost localhost>


With:

<VirtualHost *:80>


You also don't need the ServerAlias lines unless you want to direct multiple domains to the same VirtualHost

More info: httpd.apache.org/docs/current/vhosts/name-based.html

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme