The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Display website address when setting up new account

Discussion in 'General Discussion' started by daverad, Sep 18, 2007.

  1. daverad

    daverad Member

    Joined:
    Oct 19, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi Everyone,
    When setting up a new hosting account through the WHM, is it possible to automatically display the website address on the home page? For example, when setting up a new account the default page would read "Welcome to www.new-hosting-account-domain-name.com" with the web address being automatically included in the page

    Currently, I just edit the page manually.

    Any help is appreciated!
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    If you're talking about the files in your skeleton directory being copied to that account, why not change index.html to index.php and have a little snippet of PHP code to display that information based off the URL requested?
     
  3. daverad

    daverad Member

    Joined:
    Oct 19, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Thanks David. That is what I am looking for but I don't know what code to include on the page. Would you be able to tell me what that code is or give me some advice where I could find that information?

    Regards,
    Dave
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You may want to use:

    PHP:
    <?php echo $_SERVER["HTTP_HOST"]; ?>
    ... where you want to display the domain name.


    For example, your old HTML code may be:

    HTML:
    <h1>Welcome to MyDomain.com!</h1>
    To make the code dynamic so it changes based on what domain the user is visiting, you would rename the file in your skeleton directory from index.html to index.php (so PHP code will be interpreted) and change HTML code (based off the above example) as follows:

    HTML:
    <h1>Welcome to <?php echo $_SERVER["HTTP_HOST"]; ?>!</h1>
    For more documentation on PHP variables like this, check out this PHP documentation page:

    http://us3.php.net/manual/en/reserved.variables.php#reserved.variables.server
     
  5. daverad

    daverad Member

    Joined:
    Oct 19, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for your help, David. That is very helpful!
     
Loading...

Share This Page