Page 1 of 1

mod rewrite

Posted: Mon Sep 13, 2004 6:13 pm
by tim
well i'm not really knowledged with this feature.

but what I need to do is create sub-domains from a server off the users login

ie, they register with 'tim' it creates tim.mydomain.com in return.

Can someone please point me in some direction?

Posted: Mon Sep 13, 2004 6:29 pm
by feyd
last I saw, that's not mod_rewrite.. that's dynamic DNS handling.. although, it may be possible to do the processing in mod_rewrite through the server variables.

Posted: Mon Sep 13, 2004 6:35 pm
by timvw
first you need to make sure all domains point to the right address, zone file likes this:

Code: Select all

* IN A 255.255.255.0
then you tell apache to handle all the domains likes this:

Code: Select all

<VirtualHost 255.255.255.0>
DocumentRoot /home/user/public_html
ServerName www.domain.com
ServerAlias domain.com
ServerAlias *.domain.com
</VirtualHost>
and then a little script to do whatever

Code: Select all

eregi("^([^\.]+)\.",$HTTP_HOST,$args);
$subdomain = $args[1];
if (($subdomain != "www") && ($subdomain!= "DOMAINNAME")) {
  include("file.php");
  exit();
  }
}

Posted: Tue Sep 14, 2004 4:23 pm
by tim
ty

Posted: Wed Sep 15, 2004 1:50 am
by m3mn0n
Neat script. :)