Using a seperate domin and subdomain

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Using a seperate domin and subdomain

Post by alex.barylski »

I have a domain registered and also some sub-domains under it...

When someone visits my site and then begins viewing the subdomain...is it possible to keep the uaer at the subdomain, but if someone finds the sub-domain via a seperate domain, that the seperate domain is used, instead of the sub-domain?

http://www.domain1.com <- first visit

http://www.sub.domain1.com <- Find this page through first request
http://www.sub.domain1.com/articles1/ <-Subsequent requests stay under sub-domain
http://www.sub.domain1.com/articles2/
http://www.sub.domain1.com/articles3/
http://www.sub.domain1.com/articles4/

http://www.domain2.com <- first visit

http://www.domain2.com <- Find this page through first request
http://www.domain2.com/articles1/ <-Subsequent requests stay under sub-domain
http://www.domain2.com/articles2/
http://www.domain2.com/articles3/
http://www.domain2.com/articles4/

See what I mean? Now it is possible that using domain2 would bring them to domain1 and if they navigated back to domain2, they would have to use

http://www.sub.domain1.com instead of domain2.com

Is this even logical or can I just map domains to sub-domains in which case every time someone visits the sub-domain, regradless of how they got there, they alwasy see the domain2.com???

Cheers :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

I don't understand what you mean? Just point all of those names to the same IP address and don't use absolute URIs :?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

I don't understand either :?

but the 'subdomains' as you call them are just hosts and thus separate host records in your zone file on your dns.

you can give them different IPs or use the same IP for each and use host headers to define different sites.

I *think* your underlying question is, is it possible to keep a user on a host depending on which host they hit...the answer to that is yes.

if you use relative paths in your site, it will stay within the same host.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

should be able to use $_SERVER['HTTP_HOST'] as well. ;)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

As it stands I do not wish to purchase 4 seperate domains as I already have one which I like...

For the time being I have segmented my site content into 4 sub-domains...

People currently will visit my primary domain and will likely navigate to each section accordingly to fit what they are looking for...

Eventually I want to seperate the sub-domains completely into their domain address

http://www.sub1.domain.com = http://www.mydomain.com
http://www.sub2.domain.com = http://www.anotherdomain.com
...

But because some people might bookmark pages as:
http://www.sub1.domain.com

I need the server to recognize that http://www.sub1.domain.com now maps to http://www.mydomain.com - when I do get aorund to buying the domain names...
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Hockey wrote:As it stands I do not wish to purchase 4 seperate domains as I already have one which I like...

For the time being I have segmented my site content into 4 sub-domains...

People currently will visit my primary domain and will likely navigate to each section accordingly to fit what they are looking for...

Eventually I want to seperate the sub-domains completely into their domain address

http://www.sub1.domain.com = http://www.mydomain.com
http://www.sub2.domain.com = http://www.anotherdomain.com
...

But because some people might bookmark pages as:
http://www.sub1.domain.com

I need the server to recognize that http://www.sub1.domain.com now maps to http://www.mydomain.com - when I do get aorund to buying the domain names...
Yeah it shouldn't be an issue.... you can have as many subdomains as you want without having to pay for them (although some regsitrars that offer DNS with themselves with try and scam you into paying). Run your own DNS is my advice ;)
Post Reply