Creating virtual sub-domains

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

Creating virtual sub-domains

Postby Get Free » 10. November 2005 00:45

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.
Get Free
 
Posts: 7
Joined: 09. October 2005 00:18

Postby Wiedmann » 10. November 2005 02:18

Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Get Free » 10. November 2005 06:31

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?
Get Free
 
Posts: 7
Joined: 09. October 2005 00:18

Postby Wiedmann » 10. November 2005 09:27

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.?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby cj_nza » 10. November 2005 11:23

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)
cj_nza
 
Posts: 53
Joined: 06. September 2005 11:49

Postby Get Free » 10. November 2005 19:58

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.
Get Free
 
Posts: 7
Joined: 09. October 2005 00:18

Postby Wiedmann » 10. November 2005 22:50

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.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Get Free » 11. November 2005 01:26

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:
Get Free
 
Posts: 7
Joined: 09. October 2005 00:18

Postby Wiedmann » 11. November 2005 01:34

the backslashed worked too

Sometimes.

BTW its wrong in the Apache config => Read the Apache manual.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby tobijahk » 29. November 2005 06:05

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?
tobijahk
 
Posts: 2
Joined: 29. November 2005 05:51

Postby tobijahk » 29. November 2005 06:14

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/ ^^
tobijahk
 
Posts: 2
Joined: 29. November 2005 05:51

how?

Postby spuri » 13. June 2006 10:58

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>
spuri
 
Posts: 6
Joined: 28. September 2005 10:29

Postby deepsurfer » 13. June 2006 13:09

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>
chirio Deep
Wie sagte einst der MCP aus Tron auf dem Bildschirm zu schreiben Pflegte
" ... end of communication ... "
User avatar
deepsurfer
AF Moderator
 
Posts: 6440
Joined: 23. November 2004 10:44
Location: Cologne
Operating System: Win-XP / Win7 / Linux -Debian

deny

Postby spuri » 13. June 2006 13:35

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>
spuri
 
Posts: 6
Joined: 28. September 2005 10:29


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 54 guests