Two domains, 1 hosting, domain alias, and $_SERVER['SERVER_NAME']

One hosting, and have two domain, one primary and one more alias.
But the alias is only to be pointed into one of the subdirectory, and main domain hppy as it is.

Example:

public_html/ <- main domain take from here
-- dir1/
-- dir2/
-- 2nddomain/ <-- domain alias from here
--- index.html
-- dir3/
- index.php


So, in root directory, in this case public_html/ create index.php as below:

<?
if ( $_SERVER['SERVER_NAME'] == "number1.ac.com.my")
header("Location: http://number1.ac.com.my/number1/");
else
header("Location: http://anotherweb.com.my/index.php");;
?>


Ok. Good luck.

Thanks

//alak

Comments

Popular posts from this blog

SAP: Segregate Different SMTP Mail Server Based on Sender Domain

SAP Client Copy Error: Errors occurred during export of container object FINB-TR-DERIVATION

Quick Dirty Script for Checking Oracle Data Gurad Gap and Emailing it