Page 1 of 1

Creating virtual sub-domains

PostPosted: 10. November 2005 00:45
by Get Free
Is it possible to create a virtual sub-domain that is an alias of a directory??

For example:
"http://windows.localhost" => "c:\windows"

I've been searching the apache docs but I haven't been successfull finding how to do that.

I'would apreciate any help.
Thanks.

PostPosted: 10. November 2005 02:18
by Wiedmann

PostPosted: 10. November 2005 06:31
by Get Free
Thank you, Wiedmann.

I added these lines to httpd.conf
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "D:/Windows & Programs files/xampplite/htdocs"
</VirtualHost>

<VirtualHost *:80>
   ServerName windows.localhost
   DocumentRoot "c:\windows"
</VirtualHost>
But It doesn't work.
I can get access to localhost but I cant access to windows.localhost

What am I doing wrong?

PostPosted: 10. November 2005 09:27
by Wiedmann
I can get access to localhost but I cant access to windows.localhost

Sorry, I'm not really good in guessing... Any error message, e.g.?

PostPosted: 10. November 2005 11:23
by cj_nza
It is not clear from your post whether or not you created an entry for windows.local in your hosts file. (Windows\system32\drivers\etc\hosts)

PostPosted: 10. November 2005 19:58
by Get Free
Wiedmann wrote:
I can get access to localhost but I cant access to windows.localhost

Sorry, I'm not really good in guessing... Any error message, e.g.?

if I type in browser "localhost", I see the page "D:/Windows & Programs files/xampplite/htdocs/index.php" which is right and expected if you see the code I added to httpd.conf (see below)

but, if I type in browser "windows.localhost", I see no page, nothing. I just see de default "page not found" of IE.
What I would expect to happend is to see the page "c:\windows\index.php"

To achieve that, I added this code to httpd.conf
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "D:/Windows & Programs files/xampplite/htdocs"
</VirtualHost>

<VirtualHost *:80>
   ServerName windows.localhost
   DocumentRoot "c:\windows"
</VirtualHost>
What I want to know is whether this code is right and whether it should produce the results I expect.

Tkanks.

PostPosted: 10. November 2005 22:50
by Wiedmann
I see no page, nothing. I just see de default "page not found" of IE.

Read the last answer from "cj_nza". Your OS / applications can not find a ip for the dns name "windows.localhost"

DocumentRoot "c:\windows"

You should use forward slashs ("/") in the apache config files.

PostPosted: 11. November 2005 01:26
by Get Free
Ohhh... I did'n see cj_nza's reply.

thank you, cj_nza and Wiedmann. Now things are working fine.

and.. the backslashed worked too. Even using combinations of slashes and backslashes like this: "c:\windows/system\" :shock:

PostPosted: 11. November 2005 01:34
by Wiedmann
the backslashed worked too

Sometimes.

BTW its wrong in the Apache config => Read the Apache manual.

PostPosted: 29. November 2005 06:05
by tobijahk
cj_nza wrote:It is not clear from your post whether or not you created an entry for windows.local in your hosts file. (Windows\system32\drivers\etc\hosts)


What should that entry look like?

PostPosted: 29. November 2005 06:14
by tobijahk
Get Free wrote:Ohhh... I did'n see cj_nza's reply.

thank you, cj_nza and Wiedmann. Now things are working fine.

and.. the backslashed worked too. Even using combinations of slashes and backslashes like this: "c:\windows/system" :shock:


How did you get it to work? I have tried to add the same code to my httpd.conf and I have tried to edit my hosts file in the system32/etc dir but I can't get it to work! when I open /windows.localhost/ I get /localhost/ ^^

how?

PostPosted: 13. June 2006 10:58
by spuri
Could you please check my setting? Looks ok for my but i get error 403 Access forbidden! :( but i don't know why

C:\WINDOWS\system32\drivers\etc\hosts
127.0.0.1 localhost
127.0.0.1 windows.localhost

# httpd.conf - bottom

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot D:/xampp/htdocs
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
ServerName windows.localhost
DocumentRoot C:/temp
</VirtualHost>

PostPosted: 13. June 2006 13:09
by deepsurfer
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot D:/xampp/htdocs
ServerName localhost
<Directory "D:/xampp/htdocs">
        AllowOverride All
        Options IncludesNoExec
        Order allow,deny
        Allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName windows.localhost
DocumentRoot C:/temp
<Directory "D:/temp">
        AllowOverride All
        Options +Indexes IncludesNoExec #<- +Indexes for see files in folder
        Order allow,deny
        Deny from all             #<- better to block all other
        Allow from 127.0.0.1   #<- allow from local or write IP from other PC in LAN
</Directory>
</VirtualHost>

deny

PostPosted: 13. June 2006 13:35
by spuri
many thanks

that works for me

<VirtualHost *:80>
ServerName windows.localhost
DocumentRoot C:/temp
<Directory "C:/temp">
AllowOverride All
Options Indexes
Order Deny,Allow
Deny from all
Allow from localhost
</Directory>
</VirtualHost>