Display website address when setting up new account

daverad

Member
Oct 19, 2006
5
0
151
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!
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
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!
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?
 

daverad

Member
Oct 19, 2006
5
0
151
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
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
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
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