PHP code for add in new addon domain like cPanel

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cohq82
Forum Commoner
Posts: 43
Joined: Mon Apr 21, 2008 8:38 pm

PHP code for add in new addon domain like cPanel

Post by cohq82 »

I have a website using drupal. I want to be able to have users to use their own domain name. For example, my website is http://www.website.com/userA and if user go to usera.com it will be http://www.website.com/userA instead.

I see that in cPanel there is a feature call Addon Domain where I can setup redirection for a domain to point to a specific file or folder. How to program this in the backend using PHP? Or is this only something that host provider can do? Thanks.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: PHP code for add in new addon domain like cPanel

Post by aceconcepts »

In order to do this, the nameservers of the user's domain will need to be renamed to the destination domain and then a sub folder such as userA will need to be created. The change of the nameservers can take up to 48hrs.

In my mind this is something that will have to be done via the hosting company.
cohq82
Forum Commoner
Posts: 43
Joined: Mon Apr 21, 2008 8:38 pm

Re: PHP code for add in new addon domain like cPanel

Post by cohq82 »

What I understand is that there are 2 parts:

1. Change DNS of user's domain name

2. Configure add-on domain name to point to a specific folder or file.

The 1st part can be done by users. For second part, I know my hosting company uses cPanel which is PHP anyways and they provide the admin to configure that. How do I program that? Is it required dedicated server? cPanel must use some API to do it, right?
Post Reply