#native_company# #native_desc#
#native_cta#

faking real vhosts

By Nico Gawenda
on June 4, 2002

put this at the very beginning of your php
this powerful hack implies to have *.yourdomain actually pointing to it.
first check for some vhost. this can be done much better, but this is easier to understand 🙂

if (isset($HTTP_HOST) && strpos($HTTP_HOST,'.yourdomain.com')>0 && strpos($HTTP_HOST,'www.yourdomain.com')===false ){
	// extract vhost, again put your regexp here ;)
	$vhost = substr($HTTP_HOST,0,strpos($HTTP_HOST,'.'));
	// redirect whereever you want... you could also look for an id with username=$vhost in a database,
	// and redirect to something like /index.php?show_user=$id
	header('Location: http://www.yourdomain.com/'.$vhost.'/index.php');
	exit;
}

just my 2cents, i hope it helps 🙂