comparison 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
comparison
equal deleted inserted replaced
44:38d209611508 45:8bc395c87c6f
9 } 9 }
10 else {$country_code = "US" ; } 10 else {$country_code = "US" ; }
11 11
12 dl("cc: $country_code\n"); 12 dl("cc: $country_code\n");
13 13
14 $home=$_SERVER['SERVER_NAME'];
15 $path=$_SERVER['SCRIPT_NAME'];
16 $myBase="http://$home".substr($path,0,strlen($path)-10);
17 dl("base: $myBase\n");
18
14 switch($country_code) { 19 switch($country_code) {
15 case "CA": 20 case "CA":
16 Header( "HTTP/1.1 301 Moved Permanently" ); 21 Header( "HTTP/1.1 301 Moved Permanently" );
17 Header ("Location: http://test.markup.co.uk/ywww/ca/" ); 22 Header ("Location: $myBase/ca/" );
18 break; 23 break;
19 case "DE": 24 case "DE":
20 Header( "HTTP/1.1 301 Moved Permanently" ); 25 Header( "HTTP/1.1 301 Moved Permanently" );
21 Header ("Location: http://test.markup.co.uk/ywww/de/" ); 26 Header ("Location: $myBase/de/" );
22 break; 27 break;
23 case "FR": 28 case "FR":
24 Header( "HTTP/1.1 301 Moved Permanently" ); 29 Header( "HTTP/1.1 301 Moved Permanently" );
25 Header ("Location: http://test.markup.co.uk/ywww/fr/" ); 30 Header ("Location: $myBase/fr/" );
26 break; 31 break;
27 case "GB": 32 case "GB":
28 Header( "HTTP/1.1 301 Moved Permanently" ); 33 Header( "HTTP/1.1 301 Moved Permanently" );
29 Header ("Location: http://test.markup.co.uk/ywww/uk/" ); 34 Header ("Location: $myBase/uk/" );
30 break; 35 break;
31 case "US": 36 case "US":
32 Header( "HTTP/1.1 301 Moved Permanently" ); 37 Header( "HTTP/1.1 301 Moved Permanently" );
33 Header ("Location: http://test.markup.co.uk/ywww/us/" ); 38 Header ("Location: $myBase/us/" );
34 break; 39 break;
35 default: 40 default:
36 Header( "HTTP/1.1 301 Moved Permanently" ); 41 Header( "HTTP/1.1 301 Moved Permanently" );
37 Header ("Location: http://test.markup.co.uk/ywww/us/" ); 42 Header ("Location: $myBase/us/" );
38 break; 43 break;
39 } 44 }
40 ?> 45 ?>
41 <html> 46 <html>
42 <head> 47 <head>