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
Attempt to assign property of non-object in...
I'm having issues with the following function in PHP 5...
function getTreeWithChildre
php global variable
how can we create global variable so we can use its value in any form.. Please give example to
How to copy a part of a vector in a raw memory
Hi,
How can I copy a part of a vector into a memory:
1
2
3
4
5
how can i display php source code snippets ?
I am outputting some pho code .. and I want to display the source code so people can copy and paste
strtotime issue
Hey all,
I'm playing around with some code, and basically the idea is:
Person changes
FTP issues
Hi all,
I am currently facing some serious problems with a script and really need some ad
PHP hyperlinks generator - HELP plz
Hi
I need some help to get this done using php:
1 - I have few hyperlinks say 500
phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:
Code: [Select]$mailer = new PHPMailer();
$mailer-&
mysql_real_escape_string
Let me preface this that I am very much a PHP noob, but I have some SQL training (not necessarily My
Sharing PHP Sessions Across Domains
I am in the process of writing a script to share a php session across various domains I have.
The