Page 1 of 1

Sub-domains on Localhost

Posted: Fri Sep 03, 2004 11:00 am
by Gen-ik
Hi guys.


I'm running Apache and PHP under Windows and was wondering if it's possible to set-up sub-domains on my Localhost (127.0.0.1) ?

If not.. is there a way (maybe using .htaccess) to force the server into thinking that a directory is the server root? By that I mean if I was developing a site at //127.0.0.1/newsite/ and used a url in either html or php that looked something like /style/fonts.css it would actually point towards //127.0.0.1/newsite/style/ and not //127.0.0.1/style/

Hope that makes sense :)

The reason I'm asking is that a lot of new sites I'm working on need to refer to the server root (ie //127.0.0.1/) and it's a real pain in the rear having to shift sites into the server root ever time I need to work on them.

Hope you guys can help me out with this one.


Thanks in advance.
Si //

Posted: Fri Sep 03, 2004 1:42 pm
by Buddha443556
Using the VirtualHost directive and your Host file you can setup as many subdomains as you need.

http://httpd.apache.org/docs/mod/core.html#virtualhost
http://httpd.apache.org/docs-2.0/vhosts/examples.html

Posted: Fri Sep 03, 2004 7:07 pm
by timvw
there is another thing you need to do:

edit your /etc/hosts or c:/windows/system32/drivers/etc/hosts

127.0.0.1 localhost test sample.com foo.bar

Posted: Sat Sep 04, 2004 3:59 am
by qads
uh...this is what i found in my host file when i opend it up 8O
127.0.0.0 localhost
127.0.0.1 and.doxdesk.com
127.0.0.2 auditmypc.com
127.0.0.3 boards.cexx.org
127.0.0.4 bulletproofsoft.net
127.0.0.5 camtech2000.net
127.0.0.6 cexx.org
127.0.0.7 computercops.us
127.0.0.8 ct7support.com
127.0.0.9 doxdesk.com
127.0.0.10 eblocs.com
127.0.0.11 enigmasoftwaregroup.com
127.0.0.12 forum.aumha.org
127.0.0.13 free-spyware-scan.com
127.0.0.14 free-web-browsers.com
127.0.0.15 grc.com
127.0.0.16 grisoft.com
127.0.0.17 hackfaq.org
127.0.0.18 hazeleger.net
127.0.0.19 javacoolsoftware.com
127.0.0.20 kellys-korner-xp.com
127.0.0.21 kephyr.com
127.0.0.22 lavasoft.de
127.0.0.23 lavasoftusa.com
127.0.0.24 lurkhere.com
127.0.0.25 majorgeeks.com
127.0.0.26 merijn.org
127.0.0.27 mjc1.com
127.0.0.28 moosoft.com
127.0.0.29 mvps.org
127.0.0.30 net-integration.net
127.0.0.31 noadware.net
127.0.0.32 no-spybot.com
127.0.0.33 onlinepcfix.com
127.0.0.34 pchell.com
127.0.0.35 pestpatrol.com
127.0.0.36 safer-networking.org
127.0.0.37 secure.spykiller.com
127.0.0.38 secureie.com
127.0.0.39 security.kolla.de
127.0.0.40 spybot.info
127.0.0.41 spychecker.com
127.0.0.42 spychecker.com
127.0.0.43 spycop.com
127.0.0.44 spyguard.com
127.0.0.45 spykiller.com
127.0.0.46 spyware.co.uk
127.0.0.47 spyware-cop.com
127.0.0.48 spywareinfo.com
127.0.0.49 spywarenuker.com
127.0.0.50 spywareremove.com
127.0.0.51 spywareremove.com
127.0.0.52 stopzillapro.com
127.0.0.53 sunbelt-software.com
127.0.0.54 thiefware.com
127.0.0.55 tomcoyote.org
127.0.0.56 unwantedlinks.com
127.0.0.57 webattack.com
127.0.0.58 wilders.org
127.0.0.59 http://www.auditmypc.com
127.0.0.60 http://www.bulletproofsoft.net
127.0.0.61 http://www.cexx.org
127.0.0.62 http://www.computercops.us
127.0.0.63 http://www.ct7support.com
127.0.0.64 http://www.doxdesk.com
127.0.0.65 http://www.eblocs.com
127.0.0.66 http://www.enigmasoftwaregroup.com
127.0.0.67 http://www.free-spyware-scan.com
127.0.0.68 http://www.free-web-browsers.com
127.0.0.69 http://www.grc.com
127.0.0.70 http://www.grisoft.com
127.0.0.71 http://www.hackfaq.org
127.0.0.72 http://www.hazeleger.net
127.0.0.73 http://www.javacoolsoftware.com
127.0.0.74 http://www.kellys-korner-xp.com
127.0.0.75 http://www.kephyr.com
127.0.0.76 http://www.lavasoft.de
127.0.0.77 http://www.lavasoftusa.com
127.0.0.78 http://www.lurkhere.com
127.0.0.79 http://www.majorgeeks.com
127.0.0.80 http://www.merijn.org
127.0.0.81 http://www.mjc1.com
127.0.0.82 http://www.moosoft.com
127.0.0.83 http://www.mvps.org
127.0.0.84 http://www.net-integration.net
127.0.0.85 http://www.noadware.net
127.0.0.86 http://www.no-spybot.com
127.0.0.87 http://www.onlinepcfix.com
127.0.0.88 http://www.pchell.com
127.0.0.89 http://www.pestpatrol.com
127.0.0.90 http://www.safer-networking.org
127.0.0.91 http://www.secureie.com
127.0.0.92 http://www.security.kolla.de
127.0.0.93 http://www.spybot.info
127.0.0.94 http://www.spychecker.com
127.0.0.95 http://www.spychecker.com
127.0.0.96 http://www.spycop.com
127.0.0.97 http://www.spyguard.com
127.0.0.98 http://www.spykiller.com
127.0.0.99 http://www.spyware.co.uk
127.0.0.100 http://www.spyware-cop.com
127.0.0.101 http://www.spywareinfo.com
127.0.0.102 http://www.spywarenuker.com
127.0.0.103 http://www.spywareremove.com
127.0.0.104 http://www.spywareremove.com
127.0.0.105 http://www.stopzillapro.com
127.0.0.106 http://www.sunbelt-software.com
127.0.0.107 http://www.thiefware.com
127.0.0.108 http://www.tomcoyote.org
127.0.0.109 http://www.unwantedlinks.com
127.0.0.110 http://www.webattack.com
127.0.0.111 http://www.wilders.org

Posted: Sat Sep 04, 2004 7:08 am
by timvw
some anti-spyware tools do this..... result: all hostsnames that are known to serve evil popups/banners will resolve to 127.0.0.1 and this way, you're browser won't show them anymore :)

Posted: Sat Sep 04, 2004 7:09 am
by Gen-ik
The only thing I found in my host file was 127.0.0.1 localhost

PS. The problem is sorted by the way.. I've now got "dummy host names" working on my PC... which is actually better than using sub-domains. Cheers guys :)

Posted: Sat Sep 04, 2004 7:14 am
by qads
cool, thanks tim :D

Posted: Sat Sep 04, 2004 8:53 am
by timvw
if i look at the hostnames in your case, it could be a tool that doesn't want you to install anti-spyware though :p

Posted: Sat Sep 04, 2004 9:00 am
by Gen-ik
Yeah, that's what it looks like to me as well.

There are a couple of pointers to LavaSoft in there (lavasoft.de and lavasoftusa.com) and those sites provide Adware removal applications. It looks like some nasty piece of code is trying to stop you cleaning up your system.

If I were you I would just delete them all apart from the first one (127.0.0.1 localhost) and then reboot your machine. If they reappear then you know you've got an un-invited guest on your machine somewhere.

Posted: Sat Sep 04, 2004 9:53 am
by qads
son of a..grrr.....thanks guys, i will let you know the out come :?.


EDIT
well, they didnt show up after i cleaned it up, i use Spybot - S & D and ad aware every few days, noting showed up :?

Posted: Sat Sep 11, 2004 1:59 pm
by JCMNetmedia
yeah, I was going to say there are a lot of spyware remover sites in there. One thing I found cleaning spyware out of a large company was spyware that had modified hosts so you typed in lavasoftusa or another well known site, and it actually redirected it to another webserver (run by the spyware developers) and if you downloaded their "spyware removal tool" it actually installed more. Thankfully I haven't seen a lot of that type out there.


as far as the subdomains go, you should be able to create virtualhosts that listen on 127.0.0.1 and add DNS entries or HOSTS entries (if it is linux) to match and it should work, though honestly I haven't tried it.