# Solved: HTTP Headers



## Speakersrock (Dec 16, 2006)

Hi there,
I am neededing to route domains names to defferent directories within my web servers.

(for example, domain hhhhhh.com would goto the directory on the server like this;
serverip/hhhhhh.com)

I have been told you can route things with http headers. I don't know anything about them, could you please expalin someone!?

Any help is much appreciated. Thanks.


----------



## Homenet (Feb 18, 2008)

Yes it can be done, are you using IIS or Apache?


----------



## Speakersrock (Dec 16, 2006)

Hi there,
I want to move to apache, but for now lets say IIS please! 
Welcome to the forum btw! :up:


----------



## Homenet (Feb 18, 2008)

Thankyou very much! 

I used this guide to setup multiple sites on iis before, its realtively simple to do!

http://support.microsoft.com/kb/190008

Hope that helps.


----------



## Speakersrock (Dec 16, 2006)

Oh right, thats looks just the thing! 

If you ever get a min, Do you think you would be able to chuck me a link for doing the same thing within apace my way please?
Many thanks for this though


----------



## Homenet (Feb 18, 2008)

Sure, no problem 

I've used this one before, slightly harder than iis, but thats apache in general really!

http://httpd.apache.org/docs/2.0/vhosts/examples.html


----------



## Speakersrock (Dec 16, 2006)

Homenet said:


> Sure, no problem
> 
> I've used this one before, slightly harder than iis, but thats apache in general really!
> 
> http://httpd.apache.org/docs/2.0/vhosts/examples.html


Oh wow, thanks a tonne,
Ilol, I didn't realise how much more complicated apache was though untill now!...Prehaps I'll have to leave the switch a little longer than anticipated!

Many thanks again, and enjoy the forum :up:


----------



## Homenet (Feb 18, 2008)

No problem at all.

Hehe yeh ive only really scratched the surface on Apache, its quite easy to setup an apache server with php etc, but theres a whole world of stuff that you can customise apache to do, so its worth looking at!

Thankyou for the warm welcome


----------



## Speakersrock (Dec 16, 2006)

Oh right...that figures.
Yes I have heard many things about it! 

Anytime!


----------



## Speakersrock (Dec 16, 2006)

Hi again, Sorry, I am just trying out the headders, Its says on that Microsoft page you kindly linked me to;

'6.	Click Edit, and then add the desired host header name.'

As I said, I don't even know what the headers are; what do I put in for this step please?

Thanks.


----------



## Homenet (Feb 18, 2008)

Hi, no problem!

in the host header name you just put the domain name or public ip! So you create multiple sites on iis, and then add the host header value to each one (eeee.com for site 1, bbbb.com for site 2 for example!)

hope that helps!


----------



## Speakersrock (Dec 16, 2006)

Oh right!..yeah that helps lots!
Sorry, last question, so for site 2, 3 e.t.c (the non-main host sites), the headers go in the properties for each subdirectory under the site? If that makes any sense!

Thanks.


----------



## Homenet (Feb 18, 2008)

Its fine, i dont mind helping so ask as many as you like 

Sorry im not sure i totally follow! Do you have actual differnt sites created in iis? or are you just trying to use a sub folder in the main site? Because you cant do it this way, in iis if you click Action > new > website you create the seperate websites through there! does that make sense? Note however that in windows XP's IIS you are restricted to only 1 site (unless you use an add-on script!) so im hoping your using windows server!


----------



## Speakersrock (Dec 16, 2006)

Ohhh righht!....
well you made a good guss at it for not understanding! (sorry as you have probebrly guessed by now, I am hopless at explaining things lol)

Yeah, I have just been making new directris under the main site lol.
would this be the address format such as;
yyy.xxx.com - doesn't work
xxx.com/yyy - does work?

I could be a while making new sites for all these i think lol, I'll post back later!
Thanks again.


----------



## Homenet (Feb 18, 2008)

Hehe no problem. ok well are you planning on using totally differenct domains? i.e yyy.com and bbb.com or sub-domains? ie yyy.com and bbb.yyy.com?

by the way are you handling the DNS for these domains?

Let me know how you get on?


----------



## Speakersrock (Dec 16, 2006)

Hi again!
I went to bed quite soon after my last post....So here we go again now!...

Oh, thats a good point!...No not at the moment, I don't currently have the means to fund so many different domians!....so in this case, the one I don't want to have a domain, I have to leave as a sub-directory?

I don't know quote what you mean 'handiling the DNS'. Do you mean in the respect of forwarding the domain to the servers? If so, yes.

I missed this bit out from another post you made, Yes, I am running windows servers!....and good job too, as i did't realise that about XP!


----------



## Homenet (Feb 18, 2008)

Oh right I see! ok so your going to have aaa.yourdomain.com and bbb.yourdomain.com etc?

Or are you going to have www.yourdomain.com/blarblar and www.yourdomain.com/bbbbb ?


----------



## Speakersrock (Dec 16, 2006)

Homenet said:


> Oh right I see! ok so your going to have aaa.yourdomain.com and bbb.yourdomain.com etc?
> 
> Or are you going to have www.yourdomain.com/blarblar and www.yourdomain.com/bbbbb ?


Yes, you got it (it think lol) sorry this is so confusing!

- I have currently got 'www.yourdomain.com/blarblar and www.yourdomain.com/bbbbb ?[/QUOTE]' - and thats achieved by subfolders under the main site

- I want, 'aaa.yourdomain.com and bbb.yourdomain.com etc' - plus some sites will have their own domian

---This is done by making a sepearte site for all the sites I want in this format?, Plus I put the headers in for the sites I want to have their own domain?

Hope that makes a tad of sense lol.


----------



## Homenet (Feb 18, 2008)

Hehe, yes thats exactly it! each one has its own seperate site under iis, with the domain name in the header 

Let me know how you get on with it!


----------



## Speakersrock (Dec 16, 2006)

Homenet said:


> Hehe, yes thats exactly it! each one has its own seperate site under iis, with the domain name in the header
> 
> Let me know how you get on with it!


wheyy!!..sorry about that, but we got there in the end!!!
I thought of another question for you while I was working today, but I can't rember what it is now!.....Prehaps I will remeber by the time I post back and hopefully report its all working! 

Cheers


----------



## Speakersrock (Dec 16, 2006)

Gaa!!..ermegentcy!!!

I have set it up with all my sites, and I star the main one, then I go to start the other sites, ...I get the error;

Internet Services Manager;
The service could not be started becuase it is not correctly configured. Make sure that its server bindings do not conflict with other sites running on the same machine!


HELP please!!!...becuase now no-one can access half the websites on there lol!

..........
Edit, I just found that the administration site will run along with the default site!


----------



## Homenet (Feb 18, 2008)

Oh dear! Lets see.. What did you set for each of the host header values? and how many sites have you in total?


----------



## Speakersrock (Dec 16, 2006)

yupp!..

Ok, well I have not transfered too many sites like that so far!....but here goes in explaining LOl!

I have now managed to get them started! (I hadn't added headers to them (I just thought headers had to be in the ones I wanted to use with a seperate domain, besides my main domain.

However, when I go into try view the webstes from the internet (xxx.yyy.com) Its comes up with error page. (Couldn't locate remote server)

If that makes sense, any clues please!
Thanks again.


----------



## Speakersrock (Dec 16, 2006)

errmm...this is gettign a bit confusing isn't it lol..would some screen shots help?!


----------



## Homenet (Feb 18, 2008)

Lol ok, lets have a look here.

Firstly, do your DNS A records for your domain point to your server? I.E are you controlling the DNS for the domain or is controlled by your provider? example if i do a DNS lookup on your domain name, will the A records point to your public ip?

Because if there are not then it will be up to your provider to setup the sub domains for you!

You HAVE to add the headers for all subdomains you want to use.

So at the moment lets say your domain is example.com. if someone goes to www.example.com it will go to your website. If someone goes to ggg.example.com it will get routed to your webserver, however if IIS checks all the host headers and doesnt see a header containing the value ggg.example.com then it wont load the page (hence why your getting the errors!) does that make sense?


----------



## Speakersrock (Dec 16, 2006)

Yes, DNS A does point to the IP address, and I do manage the domain DNS myself  - (lol)

RRiighhttt!! That makes sense lol.
However when I add a header to the main site, I cannot access the root page?, Only the subdirectories under it. 

Yes, that makes perfect sense, With that in mind, I will go delete a few sites and put them back as sub directories for now, and so I don't have quite so much to play with. 
I'll go fiddle with it in the mean time and let you know what results I get!

Thanks again for the continued help!


----------



## Homenet (Feb 18, 2008)

What happens when you try and access the subpage? are you just doing www.bbbbb.com or www.bbbbb.com/index.html ?

No problem anyway let me know how it goes


----------



## Speakersrock (Dec 16, 2006)

1. Returns page cannot be displayed - Forbidden!?
(www.heavens-end.co.uk)

2. same thing!

I think I have really mucked it up now lol....I bet your banging your head on the table lol.
Shall i restore a blank IIS setup, start a fresh. I will type out a real life example of the site on here, and the stups i'll do to set it up, and then you clrify?

Or do you think that is barking up the wrong tree?!


----------



## Homenet (Feb 18, 2008)

lol tell you what mate.. post a screenshot of your iis showing all your websites and post it if you would


----------



## Speakersrock (Dec 16, 2006)

lol Okay!...

here ya go!....
\/ \/

The first one shows all the websites, and sub folders. Obvioually, the subfolders which have likely neames, such as 'hosting' rather than like 'images' are sub websites!

The seccond one shows the headers, e.t.c for the main site, heavens-end.co.uk

Hope it helps you help me!..


----------



## Homenet (Feb 18, 2008)

ok well, is there any reaons why you have iis system folders in your main site? are they used? for example all the IISHELP and IISADMIN folders. Your website IS there, because if i do www.heavens-end.co.uk/IISADMIN it comes up with a directory listing denied error (indicating that the directory exists and can be seen but its contents cant be viewed as a directory!) so i would suggest that your host headers etc are setup fine here, however your other folders arent accesible (donate, hosting, help) personally i would create a new website, and point it to the root folder of where all your folders actually are! and the reason www.heavens-end.co.uk wont load is the default document for it isnt accessible!

Does that make sense? so i would create a new website, add the host header exactly as you have (cos thats right) but just include the directories you need!


----------



## Speakersrock (Dec 16, 2006)

Homenet said:


> ok well, is there any reaons why you have iis system folders in your main site? are they used? for example all the IISHELP and IISADMIN folders. Your website IS there, because if i do www.heavens-end.co.uk/IISADMIN it comes up with a directory listing denied error (indicating that the directory exists and can be seen but its contents cant be viewed as a directory!) so i would suggest that your host headers etc are setup fine here, however your other folders arent accesible (donate, hosting, help) personally i would create a new website, and point it to the root folder of where all your folders actually are! and the reason www.heavens-end.co.uk wont load is the default document for it isnt accessible!
> 
> Does that make sense? so i would create a new website, add the host header exactly as you have (cos thats right) but just include the directories you need!


Ok, thanks!...

I don;t use those IIS things, It just happened, when I started to learn IIS, I just went straight for the obvious directory (wwwroot). - I have changed that as when I do what you have kindly suggested in that case!

I have just restored a backup of it which may resolve some issues with it lol..
Ok, I think I will restore the original empty backup, and do like you say.

So to make sure I understand;

-I create the one main site (root without all the IIS gunk in it!), add the header, and leave the subdirectories for sites which won't have their own domain?

-Then create another website, and add headers for any other sites which will have their own domain

Is that right? or am I still not understanding!? (If so sorry, Im just very stressed at the moment! )


----------



## Speakersrock (Dec 16, 2006)

Okay, Just as a quick try, I have restored it all to as it was before I broke it yesterday lol.

Can you tell me if thats working!? (http://heavens-end.co.uk)

If it is, then I'll devide the sites as you advised above, If it is not, I will carry on with what i said going by what you advised (Thats If I understood right!)

Thanks!


----------



## Homenet (Feb 18, 2008)

Hey dont worry about it, we'll get there in the end 

Yes that is exactly right! and its working fine at the moment 

When you come to add the other sites with their domains, if you have any problems let me know, but you've understood it so all should be good


----------



## Speakersrock (Dec 16, 2006)

Homenet said:


> Hey dont worry about it, we'll get there in the end
> 
> Yes that is exactly right! and its working fine at the moment
> 
> When you come to add the other sites with their domains, if you have any problems let me know, but you've understood it so all should be good


so can I confirm also,
For a site in the format of xxx.heavens-end.com
I make a new site called xxx, and for the headers, put xxx ?

Cheers


----------



## Speakersrock (Dec 16, 2006)

Hi again, 
I just can't get it to use the headers!
I deleted the main heavens-end.co.uk site temparly, and changed the header of another site I had made, named 'hosting' to 'heavens-end.co.uk' It still didn't work!...It just gives 'page cannot be found error'

You think I have something very frong with my IIS instilaion full stop?


----------



## Homenet (Feb 18, 2008)

Hmm that is odd, everytime you make a change like this do you restart IIS? Could you access the hosting site internally? if you do http://localhost or http://yourinternalip does that work ok?


----------



## Speakersrock (Dec 16, 2006)

yup!..
and no, Im am not restarting IIS, just cliking ok to everything to end back at the root console.

Thats a good point! - I see the root of heavens-end.co.uk locally, but no actual websitew shows up, and I can't see anything in the subdirectories.

Does that help a bit?
Im shattered now, but first thing tomorrow I will have another fiddle and see what i can do from resting it to the default as it comes when you first intsall it.

Thanks.


----------



## Homenet (Feb 18, 2008)

I dont think its a problem with your host headers, it looks to be a problem with either your default document or just how your directories are setup!

Lets say for example your "hosting website" is located in a folder on your disk drive, c:\hosting lets say. I would create a new website and point "Home directory" tab to c:\hosting, i would then click the documents tab and tick the box saying "Enable Default content page" I would then make sure that index.html is at the top of that list (or whatever your default page is called!) Now if you wanted your hosting website to be www.heavens-end.co.uk then you would just add your host header (which you know how to do know!) and that would work

then lets say somebody pays for hosting with you and wants to have their site http://billbloggs.heavens-end.co.uk and lets say that their website is located on your disk drive as c:\billbloggs. You would then create another website in IIS, point the home directory to c:\billbloggs, enable the default document again as i mentioned before and create the host header with the value http://billbloggs.heavens-end.co.uk and that would all work!

Hope that helps because I think at the moment its just a problem with your default document page!


----------



## Speakersrock (Dec 16, 2006)

Homenet said:


> I dont think its a problem with your host headers, it looks to be a problem with either your default document or just how your directories are setup!
> 
> Lets say for example your "hosting website" is located in a folder on your disk drive, c:\hosting lets say. I would create a new website and point "Home directory" tab to c:\hosting, i would then click the documents tab and tick the box saying "Enable Default content page" I would then make sure that index.html is at the top of that list (or whatever your default page is called!) Now if you wanted your hosting website to be www.heavens-end.co.uk then you would just add your host header (which you know how to do know!) and that would work
> 
> ...


Alright! That makes perfect sense!
I will go fiddle and report back in a few!


----------



## Homenet (Feb 18, 2008)

Good luck! just checked www.heavens-end.co.uk and its working and showing your hosting site so hopefully this is what you wanted!


----------



## Speakersrock (Dec 16, 2006)

Humm, Still no luck im afraid. (Gone Backwards)

(See screen shot please!)
It still seams determined to use that default first site, and nothing else.
It won;t actually let me in to view the 'default first site' but I know when you goto http://heavens-end.co.uk, it goes to that defualt first site, and nothing else (headers are set). When I stop the default first site, It just says it cannot find page!

The header for heavens-end.co.uk site is 'heavens-end.co.uk'
The header for the seccond site hosting is'hosting.heavens-end.co.uk'

This is right?
Lol..Im sorry! - but any more ideas?!


----------



## Homenet (Feb 18, 2008)

lol no problem, we'll figure this out.

Ok do you have remote access setup to your server? if your not comfortable i understand, just may be able to resolve this a lot quicker if i took a look!

Ok so set your normal site backup. and this time add the header www.heavens-end.co.uk in.

then add the header http://hosting.heavens-end.co.uk into it and we'll try that!


----------



## Speakersrock (Dec 16, 2006)

Hmmm, well thats all set, but as far as I can see, sitill no luck!

erm, yeah, of sorts! From my computer (the one I am on now) I have a a remote desktop down to the servers. If you have XP, or w/e we can do remote assis to this compuer, which can remote assiss down to the servers!?! (may be just a tad slow though lol)

What do ya think!?


----------



## Homenet (Feb 18, 2008)

Hmm at the moment www.heavens-end.co.uk goes to your main site. and http://heavens-end.co.uk goes to your hosting site!

Yes i would very much like to do remote assistance so i can see exactly how its all setup and give me a much better chance to sort it out 

Not sure how you wanna do this, you could try offering remote assistance to me here, dont think it will work as Im behind a Cisco Pix and Cisco router! Failing that do you have remote desktop/vnc or anything setup that can be accessed via public ip? if you wanna carry this on over private message feel free


----------



## Speakersrock (Dec 16, 2006)

Humm, thats odd, For the firs one, I just get a page connt be displayed error, and for the seccond one I jjust a simple line of text I have never seen before, saying 'No web site is configured at this address.'

-Prehaps this is becuase I am local to it.

Ok, yeas prehaps I better use PM for security reasons lol....One coming your way In just a min.


----------



## Homenet (Feb 18, 2008)

we'll carry this on over pm, just so you know though depending how your dns is setup you prolly wont be able to access your website using the external domain name. we can take a look at that though!


----------



## Speakersrock (Dec 16, 2006)

Oh, that woukd make sense lol

thnaks


----------

