Welcome Guest, Not a member yet? Register   Sign In
language detection by subdomain
#2

[eluser]Unknown[/eluser]
Hey Miguel.

After reading your post, i remembered a script i scripted 4 years ago.
It's a Virtual SubDomain script, that pretty much do what you need.

So far i can tell from the script you pretty much only have to modify line 16 and 17, that determines what happens if a "subdomain" is detected, and that subdomain exist as a folder in your root.

You have to rename your current index.php file in CI to index2.php as this script needs to be the very first script to load.

Here's the code, hope you can use it.

<?php

$host = $_SERVER["HTTP_HOST"];

if( substr($host,0,4) == 'www.') {
$host = substr($host,4);
}

list ($sub, $domain, $end) = explode('.', $host);

if($end== "" OR $sub == "www") {
header("Location: index2.php");
exit;
}
else {
if(is_dir($sub)) {
header("Location: http://www.$domain.$end/$sub/");
exit;
}
else {
header("Location: index2.php");
exit;
}
}

?>

Regards Supremacy.


Messages In This Thread
language detection by subdomain - by El Forum - 05-23-2008, 09:38 AM
language detection by subdomain - by El Forum - 05-23-2008, 03:50 PM
language detection by subdomain - by El Forum - 05-24-2008, 04:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB