Jump to content

[SOLVED] Display URL Address with PHP


Recommended Posts

Hi,

 

    I have several subdomains for my main domain. On the index.php of each sudomain, I wish to redisplay the url address but with some letters capitalized. I have the following code to get and display the url:

 

<p>
<?php 
$server=$_SERVER['HTTP_HOST'];
echo $server;
?>
</p>

 

 

For example, if a user goes to http://subdomain1.domain.com, the following is displayed on the webpage:

 

subdomain1.domain.com

 

but I want the display to be

 

SubDomain1.domain.com

 

Can anyone help?

 

Thank you,

 

SupraTT

Link to comment
https://forums.phpfreaks.com/topic/103682-solved-display-url-address-with-php/
Share on other sites

Hi Daniel0,

 

    I understand what you mean. Let me clarify what I hope to accomplish. Basically, for each subdomain, I will have a unique index.php file. Therefore, for each subdomain, I just want to take $server and I just want to retain the main domain url (I also have several main domains, domain1.com, domain2.com, ...). So the php code I wish to accomplish will get the main domain url only (domain.com not subdomain1.domain.com). I will simply append the correct formatted subdomain string.

 

Thank you,

 

SupraTT

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.