Multi language - seo links


Posted on 16th Feb 2014 07:03 pm by admin

Im trying to figure out the best method to have a multi language website that will function with seo friendly links.

The code that ive used many times before.....

Did you know?Explore Trending and Topic pages for more stories like this.
Code: $_SESSION['lang'] = $lang = (isset($_GET['lang']) ?
mysql_real_escape_string(trim($_GET['lang'])) : (isset($_SESSION['lang']) ? $_SESSION['lang'] : 'en')); if (!function_exists("GetSQLValueString"))
which i like as it refreshes the page that the viewer is on and pulls down info form the db with the correct extension i.e. about_en, about_it, about_de etc etc

The problem is when the user changes the language using with the follwing...

Code: if ($_SERVER['QUERY_STRING'])
{

echo "<a href="?{$_SERVER['QUERY_STRING']}&lang=en">EN</a>";
}
else
{

echo "<a href="?lang=en">EN</a>";
}

?></li>
<li><?php if ($_SERVER['QUERY_STRING'])
{

echo "<a href="?{$_SERVER['QUERY_STRING']}&lang=it">IT</a>";
}
else
{

echo "<a href="?lang=it">IT</a>";
}

?></li>
<li><?php if ($_SERVER['QUERY_STRING'])
{

echo "<a href="?{$_SERVER['QUERY_STRING']}&lang=fr">FR</a>";
}
else
{

echo "<a href="?lang=fr">FR</a>";
the page refreshes but with '?lang=it' at the end of the address, therefore im 'presuming' the mod_rewrite will fail...

any ideas of what would be the best solution..

many thanks
No comments posted yet

Your Answer:

Login to answer
182 Like 54 Dislike
Previous forums Next forums
Other forums

Display the user's weight lost in the past week
Hello everyone,

I am working on a weight loss app for my site, and I want to display the user

need help about
i store the value of my select statement result to an array and stored it to a variable named $fname

Data Function is Its Not working IN IE8
This is my first time to use formums. I hope i can get solution for this problem. view plaincopy to

Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :

PHP Include w/If IE Condition Statement?
I was having a problem with Internet Exploder (big surprise, right?) displaying my drop down menus i

insert/update functions for mysql, what do you think?
I am working on two really simple functions that automatically generate (and execute) insert and upd

Do something every fifth time?
I'm trying to write a loop, but I want it to do something different after every fifth instance. Like

fire away
i launched about 4 months ago as a lagit co. i have 2 paying clients, 1probono, 1 side progect, and

Keeping data in form
How can I keep whatever I write in the form?

Troubles with a spider class
I am building a spider that will crawl through random whitepages (eg. anywho.com, switchboard.com, w

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash