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.....

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

182 Like 54 Dislike
Previous php-forum Next php-forum
Other php-forum

PHP & Images [Resize, Crop, Save]
Hey! Well I have a little dilema, hoping I could find some guidance.

I have a CMS and on the

Php navigation
I have four buttons on a php page.
If i click a button it will redirect to different php pages.

help with mysql_error()
Hi,

I am trying to insert data into a table, but I am not able to insert it. I wanted to see

Images in email problem
I found this script for sending emails, it works but if the email has <img src="image.jp

mysqli_fetch_assoc returns multiple arrays, how to return a single array
Hello, I am using mysqli_fetch_assoc which is returning multiple rows, so it looks like:

Code

Email "$"
Hello!!

Any PHP guy with a bit of a knowledge in Flash ?

When I send a JPEG from flash

Inserting 100x and 100y coordinates in mysql table - easy
Is there a way to insert this data into a mysql table named 'map' with the fields: 'x int 3' , 'y in

Find occurences of unicode characters in string
I need to prohibit filenames with everything but English characters and numbers but regexp and strin

Filename and Line Number Custom Error
I have a class, with a method that accepts 2 parameters. I would like to output error messages.

Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there

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