Unknown subdomains.

Using a single web hosting account to host multiple sites

Postby Dexterz » Wed Nov 01, 2006 12:48 am

All the sub domains point to the main document root, right?


How do you resolve the above described problem if there is no "physical" sub domain. And the url format is used just to make url look easier? Like i would like to do
www.anything.domain.com -> www.domain.com/app/action.asp?parameter=anything

I just want to send over 'anything' as parameter. Is it possible to do it without physical sub domain (which i think will involve sub directories)?[/quote]
Dexterz
 
Posts: 6
Joined: Tue Oct 31, 2006 11:25 pm

Postby john2007 » Wed Nov 01, 2006 7:06 am

Dexterz wrote:How do you resolve the above described problem if there is no "physical" sub domain. And the url format is used just to make url look easier? Like i would like to do
www.anything.domain.com -> www.domain.com/app/action.asp?parameter=anything

I just want to send over 'anything' as parameter. Is it possible to do it without physical sub domain (which i think will involve sub directories)?

In a DNS context you would just have *.domain.com resolve to domain.com

And in apache you'd add in a ServerAlias *.domain.com into the virtual host. As per the modrewrite, rewrite that should be trivial too, but i'm not the expert to write it out here.
john2007
 
Posts: 6
Joined: Tue Oct 31, 2006 12:31 pm

Postby richardk » Wed Nov 01, 2006 8:28 am

I do not have any DNS entry or actual directory structure of "anything" because it can be anything! Is it possilbe to do what I am trying?

To add to what john2007 said, it's Wildcard DNS that you want. Everything will get matched and send to one server/IP address.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Dexterz » Thu Nov 02, 2006 3:38 am

I'm just a novice at all this stuff
it's Wildcard DNS that you want.

What do I have to put in which configuration file of apache
in apache you'd add in a ServerAlias *.domain.com into the virtual host.

Again...what do I have to write in the config file? I'll give it a try anyway. But it will be great if you can chip in the detail.
Thanks for quick response.
Dexterz
 
Posts: 6
Joined: Tue Oct 31, 2006 11:25 pm

Postby john2007 » Thu Nov 02, 2006 6:04 am

For the wildcard DNS you need to contact whomever does your DNS and have them take care of it.

Once you get DNS working you should worry about mod rewrite.
john2007
 
Posts: 6
Joined: Tue Oct 31, 2006 12:31 pm

Postby richardk » Thu Nov 02, 2006 10:03 am

Wildcard DNS information: http://en.wikipedia.org/wiki/Wildcard_DNS_record

what do I have to write in the config file? I'll give it a try anyway. But it will be great if you can chip in the detail

If you web server doesn't accept requests from more than one domain you may not need to do this. If it does, there'll be a <VirtualHost> tag with your domain name in it, something like this:
Code: Select all
<VirtualHost *:80>
  ServerName    domain.com
  ServerAlias   *.domain.com
  DocumentRoot  /path/to/document/root
</VirtualHost>
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Dexterz » Fri Nov 03, 2006 7:08 pm

Thanks again for the response.
Once you get DNS working you should worry about mod rewrite.


Does that mean to achieve something like www.anything.domain.com ... all combination of possible values of 'anything' must be first configured in DNS to point to www.domain.com?

Further
I tried what Richard has written and tried many other combinations as well. Its not working :(
:cry:
I am testing on my local machine and I specified the following in httpd.conf except the DocumentRoot was the one on my machine. If I try http://a.localhost/ or anything like that I get Page can not be found
Code: Select all
<VirtualHost *:80>
  ServerName    localhost
  ServerAlias   *.localhost
  DocumentRoot  /path/to/document/root
</VirtualHost>


Just a reminder. I haven't done anything with DNS. I'm just playing with httpd.conf and/or mod_rewrite
Dexterz
 
Posts: 6
Joined: Tue Oct 31, 2006 11:25 pm

Postby richardk » Sun Nov 05, 2006 7:56 am

If you're using localhost you have to edit you hosts file (search for it) so it's something like this:
Code: Select all
127.0.0.1    localhost
127.0.0.1  a.localhost
127.0.0.1  b.localhost
127.0.0.1  c.localhost
127.0.0.1  d.localhost


Or you could get Wildcard dynamic DNS from no-ip.com.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Dexterz » Sun Nov 05, 2006 9:37 pm

Humm...Well the problem is the prefix before localhost or domain is dynamic. New ones will be added on the go. So maintaining host file is not an option, that too on clients' machines. :(
So to conclude what I am trying to achieve is not possible without involving DNS
Dexterz
 
Posts: 6
Joined: Tue Oct 31, 2006 11:25 pm

Postby richardk » Mon Nov 06, 2006 10:22 am

If your clients are accessing it (with your domain) you'll be using DNS then you can have Wildcard DNS and there won't be any problem.

So to conclude what I am trying to achieve is not possible without involving DNS

Yes. (You can use the hosts file instead when testing, or you can use no-ip.com.)
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 93 guests

cron