Page 1 of 1

Subdomain on Windows server.

PostPosted: 30. January 2009 08:53
by tuudik
Hi.
I have set up an Xampp server on windows.
I have domain like uk.domain.com
uk.domain.com is used by main server which hosts the main site.

So i want to make that my server is Subdomain.uk.domain.com
My server ip is 10.12.13.1
Subdomain is under 10.12.13.1/Subdomain

So what i have to do that Subdomain.uk.domain.com goes to 10.12.13.1/Subdomain

I want to setup other things to on server with ip 10.12.13.1 like:
Subdomain1.uk.domain.com goes to 10.12.13.1/Subdomain1
Subdomain2.uk.domain.com goes to 10.12.13.1/Subdomain2
and so on.

I cant set my QIP directly to redirect Subdomain.uk.domain.com to 10.12.13.1/Subdomain

Help me out guys. I hope you understand my problem.

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 09:12
by Izzy
Do a forum search for virtualhost or vhost in the XAMPP for Windows forum and read some of the posts that will perhaps give you some ideas of what to do - there are many successful examples on the forums - the file to add your vhosts in is xampp\apache\conf\extra\httpd-vhosts.conf it has some examples already but the forum examples are more realistic.

You will also be editing C:\Windows\system32\drivers\etc\hosts file and drag it into your text editor for reading and editing to add your vhosts that you create for your sub domains like so:

127.0.0.1 localhost
10.12.13.1 uk.domain.com
10.12.13.1 subdomain.uk.domain.com
10.12.13.1 subdomain1
10.12.13.1 subdomain2
10.12.13.1 subdomain3

and so on etc. get the idea?

Do some reading then have a go with just one vhost and if you get that working then add others in the same style as the first only change the folders and paths etc.

If you have a go then get stuck paste your vhosts conf file and your hosts file with as much detail as possible of what you have done and someone here will take a look at it for you.

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 10:28
by tuudik
So i tried
i putted in httpd-vhosts.conf this code:
Code: Select all
   
NameVirtualHost *:80

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

    <VirtualHost *:80>
    ServerName Ĺ›ubdomain
    DocumentRoot /xampp/htdocs/subdomain
    <Directory /xampp/htdocs/subdomain >
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>


And in hosts file
Code: Select all
127.0.0.1       localhost
10.28.0.30     uk.domain.com
10.28.0.30   subdomain.uk.domain.com


But still when i go to address subdomain.uk.domain.com it directs to server htdocs root 10.12.13.1

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 10:45
by Izzy
Try this and change the drive letter if xampp is not in the C:\ drive.
Code: Select all
   
NameVirtualHost *:80

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

    <VirtualHost *:80>
    ServerName subdomain.uk.domain.com
    DocumentRoot C:/xampp/htdocs/subdomain
    <Directory C:/xampp/htdocs/subdomain >
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>


And in hosts file
Code: Select all
127.0.0.1       localhost
10.28.0.31    uk.domain.com
10.28.0.31     subdomain.uk.domain.com


http://subdomain.uk.domain.com should go to the htdocs/subdomain folder.

http://localhost should go to htdocs root folder



Is xampp on 10.28.0.31

Where is 10.28.0.30 as you can't change to this in your hosts file that xampp is on.

I don't know yet whether I understand fully what you are trying to do on your LAN.

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 10:50
by tuudik
Now it goes to:
Code: Select all
http://subdomain.uk.domain.com/subdomain/index.php/Frontpage


should go
Code: Select all
http://subdomain.uk.domain.com/index.php/Frontpage

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 10:56
by tuudik
10.28.0.30 is 10.12.13.1
i just changed 10.28.0.30 to 10.12.13.1 in this topic for security reasons.

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 11:06
by Izzy
You local IPs are secure as they are only accessible from within your LAN and anyway it is all over your first post????
"Address information
10.12.13.1 is part of a special address block (10.0.0.0 - 10.255.255.255) that is reserved for private networks.'

tuudik wrote:Now it goes to:
Code: Select all
http://subdomain.uk.domain.com/subdomain/index.php/Frontpage
should go
Code: Select all
http://subdomain.uk.domain.com/index.php/Frontpage
That looks odd as you are saying your subdomain.uk.domain.com is in htdocs/index.php/Frontpage folder.

Do you have a folder called index.php?

If so you change the DocumentRoot and the <Directory> to this address for example
DocumentRoot C:/xampp/htdocs/index.php/Frontpage
Then it will go where you want.

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 11:10
by tuudik
The index.php script is just done so.

Actually its like that
Code: Select all
http://subdomain.uk.domain.com/subdomain/index.php


should go
Code: Select all
http://subdomain.uk.domain.com/index.php

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 11:16
by Izzy
tuudik wrote:The index.php script is just done so.

Actually its like that
Code: Select all
http://subdomain.uk.domain.com/subdomain/index.php


should go
Code: Select all
http://subdomain.uk.domain.com/index.php


Now the first vhost I posted above should do just that.

DocumentRoot C:/xampp/htdocs/subdomain
<Directory C:/xampp/htdocs/subdomain >


http://subdomain.uk.domain.com
Should go to:
http://subdomain.uk.domain.com/index.php

your hosts file could also look like this
Code: Select all
127.0.0.1       localhost
127.0.0.1       uk.domain.com
127.0.0.1       subdomain.uk.domain.com

10.28.0.31     uk.domain.com
10.28.0.31     subdomain.uk.domain.com

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 11:32
by tuudik
Thanks a lot!
Maybe i could handle it without your help but still have to thank because without you i would have already gone another way.
Problem was actually in wikis local settings that kept directing.
:D
so it was working all the time
:D

Re: Subdomain on Windows server.

PostPosted: 30. January 2009 11:37
by Izzy
Your welcome and thanks for posting back.

If you have more issues then it pays to give as many details as possible as we have no way of knowing what you can see on your monitor or what you are doing or have done.

Good luck and best wishes with your project.