Reply
Redirection based on language
Old 06-12-2009, 09:19 PM Redirection based on language
kcmartz's Avatar
Skilled Talker

Latest Blog Post:
Hello
Posts: 92
Name: Kenson
Location: Washington, USA
Trades: 0
Similar to "based on IP" but I want to have my website in english AND Spanish, how to do?
__________________
Thanks, kcmartz
webmaster@kcmartz.com for problems with my site.
(Working on building a completely PHP site)
kcmartz is offline
Reply With Quote
View Public Profile Visit kcmartz's homepage!
 
 
When You Register, These Ads Go Away!
Old 06-13-2009, 12:14 AM Re: Redirection based on language
NullPointer's Avatar
Will Code for Food

Latest Blog Post:
Easy PHP Search with Opera
Posts: 1,068
Name: Matt
Location: Irvine, CA
Trades: 0
One way would be to determine the user's preference on their first visit, set a cookie, and redirect based on the value you set.
__________________
Tinsology | How to Post Code | EverythingDev
NullPointer is offline
Reply With Quote
View Public Profile
 
Old 06-14-2009, 12:48 AM Re: Redirection based on language
kcmartz's Avatar
Skilled Talker

Latest Blog Post:
Hello
Posts: 92
Name: Kenson
Location: Washington, USA
Trades: 0
How do you do that? Could you give me some sample code? Thanks!
__________________
Thanks, kcmartz
webmaster@kcmartz.com for problems with my site.
(Working on building a completely PHP site)
kcmartz is offline
Reply With Quote
View Public Profile Visit kcmartz's homepage!
 
Old 06-14-2009, 03:12 PM Re: Redirection based on language
tripy's Avatar
Do not try this at home!

Posts: 3,176
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
you can check the value of
PHP Code:
$_SERVER['HTTP_ACCEPT_LANGUAGE'
to find which languages are configured on the client browser, and in which preference.

For example, my firefox is setup as:
Code:
Accept-Language=en-gb,en;q=0.5
</span>
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is online now
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 06-15-2009, 11:02 AM Re: Redirection based on language
kcmartz's Avatar
Skilled Talker

Latest Blog Post:
Hello
Posts: 92
Name: Kenson
Location: Washington, USA
Trades: 0
How do I (the code) for redirecting, I will create the translated pages for redirecting automatically, but how I do that exactly?
__________________
Thanks, kcmartz
webmaster@kcmartz.com for problems with my site.
(Working on building a completely PHP site)
kcmartz is offline
Reply With Quote
View Public Profile Visit kcmartz's homepage!
 
Old 06-16-2009, 02:28 AM Re: Redirection based on language
Experienced Talker

Posts: 46
Name: Daniel Cer
Trades: 0
Quote:
Originally Posted by kcmartz View Post
How do I (the code) for redirecting, I will create the translated pages for redirecting automatically, but how I do that exactly?
Use:

<?php
header( 'Location: http://yoursite.com/lang_specific_page.html' ) ;
?>

However, for something like this, Google is your friend. Searching for "redirect code php" (http://www.google.com/search?q=redirect+code+php) returns a bunch of pages with a code snippet like the one above.
danielcer is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Redirection based on language
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.12306 seconds with 13 queries