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
Progress bar for webpage
Hi,
I want to implement a progress/waiting bar on my webpage - exactly the same thing that the Mi
Oracle11g Patch issue
Hi all,
I'm getting the following error while installing Oracle11g Patch 11.1.0.7.0 on IBM-AI
PHP switch function help
Hi, I am trying to create a search function for a directory website. On the search function on html
Character Set Setup
Whats the best character set to use if you want every character to work, and also how do you make yo
Displaying pictures
i have worked my way through storing images in directory and storing the location in mySQL db.Now i
Display error above the login forum help!
Hi guys. just so you know im not asking for someone to do this for me I just need to be pointed in t
how to timeout $doc = new DOMDocument()->load($url)
I am currently using this $doc->load($url) to fetch an rss feed.
If a feed takes long than
PHP Function Page Advice
Hi All, I am quite new to PHP and Javascript but have written an Online Shop (Mainly for Fun and edu
Generating unique numbers using php
Hi,
I need help in generating unique number using php.I tired using rand() in php.But, by using r
if php cookie set, show code...
Hi all.. I need to figure out this little snippet right quick.. seems like it should be easy enough