Mercurial > hg > ywww
diff index.php @ 45:8bc395c87c6f
less built-in use of full site address
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Sun, 06 Jan 2019 08:09:47 -0500 |
parents | 38d209611508 |
children | a67bf725e87b |
line wrap: on
line diff
--- a/index.php Sun Jan 06 07:17:03 2019 -0500 +++ b/index.php Sun Jan 06 08:09:47 2019 -0500 @@ -11,30 +11,35 @@ dl("cc: $country_code\n"); +$home=$_SERVER['SERVER_NAME']; +$path=$_SERVER['SCRIPT_NAME']; +$myBase="http://$home".substr($path,0,strlen($path)-10); +dl("base: $myBase\n"); + switch($country_code) { case "CA": Header( "HTTP/1.1 301 Moved Permanently" ); - Header ("Location: http://test.markup.co.uk/ywww/ca/" ); + Header ("Location: $myBase/ca/" ); break; case "DE": Header( "HTTP/1.1 301 Moved Permanently" ); - Header ("Location: http://test.markup.co.uk/ywww/de/" ); + Header ("Location: $myBase/de/" ); break; case "FR": Header( "HTTP/1.1 301 Moved Permanently" ); - Header ("Location: http://test.markup.co.uk/ywww/fr/" ); + Header ("Location: $myBase/fr/" ); break; case "GB": Header( "HTTP/1.1 301 Moved Permanently" ); - Header ("Location: http://test.markup.co.uk/ywww/uk/" ); + Header ("Location: $myBase/uk/" ); break; case "US": Header( "HTTP/1.1 301 Moved Permanently" ); - Header ("Location: http://test.markup.co.uk/ywww/us/" ); + Header ("Location: $myBase/us/" ); break; default: Header( "HTTP/1.1 301 Moved Permanently" ); - Header ("Location: http://test.markup.co.uk/ywww/us/" ); + Header ("Location: $myBase/us/" ); break; } ?>