Welcome to WebmasterWorld Guest from 23.20.137.66

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

language sorting in php vs.SE spiders

     
11:40 am on Jul 14, 2002 (gmt 0)

10+ Year Member



Hi
if i want to put in my page some language sorting to sent folks to the their native language versions of my www pages i can do it following way:

<?
switch($HTTP_ACCEPT_LANGUAGE):

case "hr":
include ("indexav.html");
case "bg";
include ("indexae.html");
case "en-au":
include ("indexas.html");
break;
default:
include("indexa.html");
break;
endswitch;
?>

But what about the Search engine spider will they be able to pass the index.php file?

2:46 am on Aug 13, 2002 (gmt 0)

WebmasterWorld Administrator brett_tabke is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



*bump* (was posted in the wrong forum).
5:22 am on Aug 13, 2002 (gmt 0)

10+ Year Member



Hi vanekpavel,

The answer is in the switch statement.

If the agent (browser or SE bot) doesn't request any of the specified languages then it will default to indexa.html.

As it stands if the browser requests Bulgarian, Croatian, and Australian English the script will try to include indexav.html, indexae.html, and indexas.html. If this isn't what you want insert break; after each of the top two includes. Then the script will serve the index file related to the first request sent, and only that one, or default to indexa.html.

BTW, the last break; (after include("indexa.html");) isn't necessary.

Cheers.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month