473,749 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get hostname of domain alias

Relatively new with PHP, so forgive me if this is a trivial question.
I have a site hosted with PHP. I'm thinking of getting another
hostname and alias it to this host. What I'd then like to do is have a
PHP file (i.e., index.php) that reads a variable from the request that
tells me which hostname is being served. I can then change the title
and whatnot of the returning HTML, depending on which hostname was
used. For example:

<?php
$HOSTNM = ???

if ( $HOSTNM == 'abcefg.com' )
$TITLE = 'ABCDEFG';
else
$TITLE = 'HIJKLM';

etc...
?>

Jan 8 '07 #1
1 2582
On 8 Jan 2007 10:16:47 -0800, sp****@gmail.co m wrote:
>Relatively new with PHP, so forgive me if this is a trivial question.
I have a site hosted with PHP. I'm thinking of getting another
hostname and alias it to this host. What I'd then like to do is have a
PHP file (i.e., index.php) that reads a variable from the request that
tells me which hostname is being served. I can then change the title
and whatnot of the returning HTML, depending on which hostname was
used. For example:

<?php
$HOSTNM = ???

if ( $HOSTNM == 'abcefg.com' )
$TITLE = 'ABCDEFG';
else
$TITLE = 'HIJKLM';

etc...
?>
Try $_SERVER['SERVER_NAME'] or $_SERVER['HTTP_HOST'].

--
Andy Hassall :: an**@andyh.co.u k :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jan 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5617
by: James M. | last post by:
I have 2x Front-end Web servers (Win2003 Ent IIS6.0), setup with NLB (single Affinity, also using SQLServer session state) that are hosting a few .NET ASP web applications under the Default Website in IIS, and accessing via a Intranet LAN (this is not publicly available). NETWEB1: NIC1 172.16.17.220 172.16.17.244 (NLB Virtual IP) NIC2 172.16.17.221
3
3791
by: HiChetu | last post by:
I have a host which has two NIC cards; one configured for LAN connections, and another for external connections. Say the ip address are 1) x.x.x.x - for LAN 2) y.y.y.y - for external hostname = 'hichetu' With the following code snippet...
7
4807
by: Peter Steele | last post by:
I have code to add a domain user to a local group but I'm not sure if it will work with NT domains or whether it will only work with Active Directory based systems. Here's the code: public void AddDomainUserToLocalGroup(string computerName, string groupName, string domainName, string userName) { Hashtable htRet = new Hashtable(); IADsContainer groupComputer = (IADsContainer)Win32.GetObject("WinNT://" + computerName + ",computer");
0
1524
by: James M via .NET 247 | last post by:
(I have 2x Front-end Web servers (Win2003 Ent IIS6.0), setup withNLB (single Affinity, also using SQLServer session state) thatare hosting a few .NET ASP web applications under the DefaultWebsite in IIS, and accessing via a Intranet LAN (this is notpublicly available). NETWEB1: NIC1 172.16.17.220 172.16.17.244 (NLB Virtual IP) NIC2 172.16.17.221 NETWEB2:
3
4377
by: Jeff Waskiewicz | last post by:
Hello, I think the subject says it all I am trying to return a list of domain names to later display in a combobox. I found a number of VB6 samples that show how to do this using the WNetOpenEnum and WNetEnumResource API calls. I have modified the code to work in VB 2003 but I keep getting a 487 - ERROR_INVALID_ADDRESS error. My envioronment is W2K with a W2003 DC. So I have 2 questions: 1) Is this the best way to do this in .NET?...
0
1405
by: Mahesh K. Anajni | last post by:
Hi We are working on a multilingual website. it has five URL (one original and four alias) for all the five languages. we are using RewriterRule in web.config to rewrite the Url. All this working fine on my local machine but when we have upload it on live we are facing a problem. that RewriteRule doesn't working for the alias name. it means when we request any page with alias name RewriterRule not works properly
0
955
by: ajayindelhi | last post by:
Hi, I have two user accounts in the format: <domain>\<alias> and <fully qualified domain name>\<alias>
0
1671
by: Rituparna | last post by:
How to set up hostname alias in HP-UX..
2
1857
by: Dooza | last post by:
Hi there, Using classic ASP I want to check if a username and password are correct before passing the details on to an object (stocktake module) that uses them to authenticate the object. The object defaults to a preset user if the authentication fails and doesn't warn the user, so I wanted to do the check manually before passing it to the object. Does anyone have any resources? Cheers,
0
9568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3320
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.