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

Filtering an Array Based on Value
I have a very simple script set up that pulls data from a database and is output using this code:

Limiting uploaded file type
I am working on a simple upload script, and I need it to limit the allowed file type that is uploade

PHP IMAGE UPLOAD SCRIPT
Hi for the last week i have been looking for scripts that will upload a photo to a certain folder wh

mysql UPDATE request not working and driving me crazy!!!
Hi,

I have been stuck on this for ages.

Quite simply I am trying to update my database

Apart from cron
I need to run a php file every one hour. Is there any other solution apart from cron job?

Help with Hyperlink
Hi,

What I am trying to do may be simple, I just can't get it to work. Ok...

I am usin

Socket Server
In my following socket server, I am trying to listen to a connection through port 12345 in my web br

RTF fomatting to email content
Im trying to sen an email with content is picked up from a rtf-file (file_get_contents('*.rtf'). Mai

problem with script manager
Hi iam using Net.2005.I have created ajax enabledwebsite.i have master page in which i have script m

Help with echo()
I'm having some problems with this code:

Code: echo '
<A HREF="jav

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