![]() |
|
#1
|
||||
|
||||
PHP: Display Domain NameHow would I display the domain name of the page I am at. Lets say it it www.desilva.biz/something.html and I want to display desilva.biz. Exactly like that. No www, or http:// included.
I have tried Code:
The code above displays a frontflash '/'. And not the domain.extension. __________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business. |
||||
|
#2
|
||||
|
||||
|
#3
|
||||
|
||||
|
Well, I put
PHP Code:
And it does not work. http://www.mrbobdouglas.com/new/index.php __________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business. |
|
#4
|
||||
|
||||
|
Try this, which is a full script
PHP Code:
which displays Code:
|
|
#5
|
||||
|
||||
|
Still does not show up for me. http://www.mrbobdouglas.com/new/
Also, I would rather just display the domain name, and not the full path to the page. When someone signs up for a hosting account, they will automatically get the files that belong in their account, I want the index file to read 'This is the new home of [DOMAIN NAME]' __________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business. |
|
#6
|
||||
|
||||
|
Like Allowee has already said, $_SERVER['SERVER_NAME'] is probably your best bet, however the super global array $_SERVER is only available to a PHP script in the newer versions of PHP...
If you want to troubleshoot this 'issue' yourself, just bring up a phpinfo and go through the values under the PHP Variables table on the page... __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#7
|
||||
|
||||
|
This is what finally works for me
PHP Code:
Thanks for the help guys __________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business. Last edited by BobbyDouglas : 29-Nov-2003 at 02:25.
|
|
#8
|
|||
|
|||
Re: PHP: Display Domain NameSo sorry for needing to bump this thread but will this code also work for a subdomain?
I want to use it on 404 error pages. For example, subdomain.domain.com/wrong_page is an invalid url. It will redirect to, for example, domain.com/404.html Can I display to the visitor that he might want to check out subdomain.domain.com to find what he wants? Can you please provide a simple script? Thanks! |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automate a data change php form | mjfmn | MySQL / PHP Forum | 4 | 20-Oct-2003 10:37 |
| [Linux] Installing PHP --with-mcrypt | JdS | Web Hosting Forum | 0 | 20-Aug-2003 09:40 |
| Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More | EyotaHosts | Web Hosting Advertisements & Offers | 0 | 28-Jun-2003 14:54 |
| All the big PHP script collections that matter | jrobbio | MySQL / PHP Forum | 5 | 06-Jun-2003 17:14 |
| Hosting under $8/month: 10-20GB Transfer, 300-600MB Space, PHP, MySQL, Domain Name! | fcolor | Web Hosting Advertisements & Offers | 0 | 28-Feb-2003 05:48 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The