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
No comments posted yet
Your Answer:
Login to answer
182
54
Other forums
How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.
H
How to update this array?
I am saving a string that looks this: username1, username2, username3...
into a single cell in a
how to validate date using javascript
I need to validate date in textbox using javascript..
The date is must be not greater than TODAY
Query failed issue with php script but works fine in mssql manager!
hi i have the script below which copies data from one table to another but will only insert new data
Sending CC Info by email
I am a little bit less knowledgable in the security area as most developers and I know I have a lot
generating random codes
Hi guys n gals,
I have a requirement to generate 250,000 unique codes...
These codes a
Firewall / visited websites logger
Hi.
I have a firewall implementation and I want to log all the websites visited on the machine. S
unexpected T_SL without a shift left token
Nothing too see here, I'm an idiot and resolved the problem.
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
form submit at godaddy?
Trying to test form submission at GoDaddy and it does not seem to work. Here's the page...
h