Jump to content

Recommended Posts

I am trying to create dynamically subdomains. From what I read, there are three ways to do it:

 

mod_rewrite

mod_vhost_alias

PHP, changing the apache config and restarting the server

 

I'm also thinking their is a forth way. Since my server runs WHM, I can probably create subdomains through WHM command line, though that might just be a wrapper version of method 3.

 

Now, way three seems like it could be quirky. I already have subdomains, but if I make a CNAME for *.mydomain, that is used before existingsubdomain.mydomain right?

 

Does anyone know the best way to do this dynamically? I think I'm going to look more at mod_vhost_alias, because that seems to be the one I can find the least about.

Link to comment
https://forums.phpfreaks.com/topic/121808-subdomains-and-ip-pointing/
Share on other sites

Do you know how? I looked at the WHM 11 docs but couldn't find anything about creating a subdomain. Whats worse is that I don't think my dns is setup right.

 

I setup a record for:

 

*.trenttompkins.com. A 72.29.86.138

 

But if I set my ServerAlias to *.trenttompkins.com it only works for subdomains that I have already created.

 

Am I missing something?

All WHM functionality, creating accounts, dns records, subdomains, etc are basically done via perl files in the core of the system. The API will call on the files dependent on what you are doing i.e. createAcct() - create an account. If the API has no method for creating subdomains then you will need to extend the API to do this.

 

Not sure what version of WHM it was at the time but I extended the API to allow more functionality via remote calls. This was for a webhosting company who used WHM servers for customer hosting that wanted to give the users more control over their hosting accounts via the company website and strip the functionality away from the cPanel system.

 

You will need to research this yourself as its not a case of posting a bit of code here to make it work for you.

At the time I dont think the documentation gave much info on the API itself so it was a case of figuring it out.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.