1

Ok, I have added lines like:

127.0.0.1   somedomain.com

Or some other domain that points to my routers IP, and is forwarded, but I get to the main site, but I want it to go to the subfolder I defined in my httpd-vhosts.conf:

NameVirtualHost  somedomain.com:80

<VirtualHost somedomain.com:80>
 DocumentRoot "D:/Apps/xampp/htdocs/somedomain"
 ServerName somedomain.com
 ServerAlias somedomain.com
</VirtualHost>

So, locally somedomain.com works, just remotely it goes to the root htdocs. So If I use a *:80 wildcard I works, but then everything points to the subfolder and all the other vhosts seem to get ignored.

Any Idea why this is?

1 Answer 1

1

127.0.0.1 is not going to work for any external connections as it is just local address which each host has it assigned to itself.

I would suggest to change httpd.conf so, apache process listens on your IP address assigned by DHCP

5
  • 1
    ^ Also, a hosts file only works locally. An external machine won't be able to use anothers hosts file.
    – cutrightjm
    Apr 12, 2012 at 16:47
  • So, I'll leave the hosts file alone, I just followed some instructions somewhere to get vhosts to work on Xampp apache server..
    – TrySpace
    Apr 13, 2012 at 15:33
  • Wait, m1k3y02, are you saying I have to put the <virtualhost> stuff in httpd.conf instead of the httpd-vhosts.conf?
    – TrySpace
    Apr 13, 2012 at 15:39
  • no, what I was trying to say is, that wherever you have IP address declaration it should be changed to IP address other than 127.0.0.1 as it is just loop back. So, it is the same like you would access localhost - it won't work from external/remote machine, which in your case is your host. localhost/127.0.0.1 each time references to the machine you operating at. i.e. ping localhost will ping the computer where you executed command. do ipconfig or ifconfig -a from command line and take the IP other than 127.0.0.1 and replace it in httpd.conf
    – m1k3y02
    Apr 13, 2012 at 15:49
  • Ok, turns out, yes, I used the wrong config all along, It was a combination of using the hosts file at the same time.
    – TrySpace
    Apr 13, 2012 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .