Forum Moderators: coopster & phranque

Message Too Old, No Replies

Create subdomain with perl

         

Reynolds

3:41 am on May 2, 2001 (gmt 0)

10+ Year Member



My host provider allows unlimited subdomains (as they should).
I can create subdomains using the Control Panel I get with my hosting account.

I know enough perl to create directories and files, but how does one create a subdomain?

Here's an example;

1. user enters request for subdomain in an html form.
2. cgi script reads form field and checks for availability of the subdomain.
3. if available, the script creates the subdomain.

Does anyone know how to do that? Hopefully it's so easy, I feel dumb for asking.

Thanks
Eric

sugarkane

4:49 pm on May 2, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm betting that you could do this with mod_rewrite if you're running apache (and your host has wildcard DNS set up).

If it's possible, you could do it from the perl side by scanning .htaccess for the rewrite rules already present, and if none of them match the subdomain then append a new rule to the end...

I'm a bit patchy on mod_rewrite though - can anyone confirm this?

theperlyking

5:30 pm on May 2, 2001 (gmt 0)

10+ Year Member



I use mod_rewrite on one site to allow it to have multiple subdomains, works fine - so this as you say should just be a matter of having a suitable script to modify .htaccess.

e.g

RewriteCond %{HTTP_HOST} ^subdomain.domain.com [NC]
RewriteRule .... whatever rules here :)

Reynolds

12:57 pm on May 3, 2001 (gmt 0)

10+ Year Member



Thank you for the input. I appreciate it. This is one of the few, if not the only, forums where people actually respond respectfully *and* intelligently.

I've put this on hold for now. Not worth the time.