[PHP] Domain & sub-domain redirection

<?php
/**
 * @name php for domain & sub-domain redirection
 * @author Timmy Tin(ycTIN)
 * @version 1.00
 */
switch (strtolower($_SERVER['HTTP_HOST'])) {
	case "yctin.com" : to("http://blog.yctin.com/");
	default : to("http://blog.yctin.com/");
}
 
/**
 * execute redirect action
 *
 * @param string $url
 * @example to("http://blog.yctin.com");
 */
function to($url) {
	header("Location: ".$url);exit;
}
?>

No related posts.



1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Tags: , , ,  

Leave a Reply