Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Automatic subdomain for new customers?

Discussion in 'General Discussion' started by esthos, Jan 1, 2018.

  1. esthos

    esthos Registered

    Joined:
    Jan 1, 2018
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    AU
    cPanel Access Level:
    Root Administrator
    Hi all.

    I am the administrator of a server running the latest cpanel/whm versions on CentOS 6.9.

    I have a subdomain mycompany.com - I wish to allocate all new clients username.mycompany.com upon signup.

    This is in addition to any domains they are bringing with them.

    Is there a way I can do this?

    I am resisting using mod_dir for security reasons.

    mycompany.com is owned by another user on the system, so if this presents a problem I am happy to use mycompany2.com

    Thanks in advance for any help.
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,442
    Likes Received:
    1,961
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    Is this for the purpose of providing them with a temporary URL to access their websites? If so, you could setup a custom bash script that uses the cPanel API 2 "Park" function, and then configure that script to run automatically during the account creation process using a post "Accounts::Create" hook to automatically set up the alias (parked domain) upon account creation. Here are some documents to help you get started should you want to set this up:

    Guide to Standardized Hooks - Software Development Kit - cPanel Documentation
    Guide to Standardized Hooks - Whostmgr Functions - Software Development Kit - cPanel Documentation
    cPanel API 2 Functions - Park::park - Software Development Kit - cPanel Documentation

    Another option is to simply offer instructions to end-users regarding the use of the hosts file on their computers to temporarily access their domain names before they resolve to the cPanel server:

    How to Modify your hosts File - cPanel Knowledge Base - cPanel Documentation

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice