473,796 Members | 2,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multi language site with PHP, mysql and cookies - how about search engines?

CAH
Hi

I need to make at multilanguage language site, and for that I need to
identify the users, and register there choice off language. For that i
imagine using cookies, since this is the only way to identify the
users. But from what I read search engines ignore cookies, and at the
same time I would like the users to be able to send links in there
choice of language to there friends, so I would like this sort of url
scheme.

www.site.com/en/
www.site.com/de/
www.site.com/fr/
.....

But I don´t like the idea of having a lot of duplicate files, with the
only difference being a reference to a specific column in my sql
database. What to do? How do others solve these problems?

Thanks for any advice
CAH
PS There is no reason to set up some sort of login, it would be to big
a burden on the user for this kind of site.)
www.winches.dk

Apr 9 '07 #1
7 9162
CAH wrote:
Hi

I need to make at multilanguage language site, and for that I need to
identify the users, and register there choice off language. For that i
imagine using cookies, since this is the only way to identify the
users. But from what I read search engines ignore cookies, and at the
same time I would like the users to be able to send links in there
choice of language to there friends, so I would like this sort of url
scheme.

www.site.com/en/
www.site.com/de/
www.site.com/fr/
....

But I don´t like the idea of having a lot of duplicate files, with the
only difference being a reference to a specific column in my sql
database. What to do? How do others solve these problems?
With mod_rewrite.

With that you can setup Apache to do this:
1) incoming URL:
www.site.com/en/page1.php
to
www.site.com/page1.php?lang=en

You can set up your own rules (using regular expression).

In that way you do not have to really create all these pages, but they
become virtual.
You only have to make page1.php pick up the $_GET["lang"] and make decisions
for your query based on that.
Regards,
Erwin Moller
>
Thanks for any advice
CAH
PS There is no reason to set up some sort of login, it would be to big
a burden on the user for this kind of site.)
www.winches.dk
Apr 9 '07 #2
CAH
With mod_rewrite.
>
With that you can setup Apache to do this:
1) incoming URL:www.site.com/en/page1.php
towww.site.com/page1.php?lang= en

You can set up your own rules (using regular expression).

In that way you do not have to really create all these pages, but they
become virtual.
You only have to make page1.php pick up the $_GET["lang"] and make decisions
for your query based on that.
Excellent advice, can Google register that one uses mod_rewrite, or is
it none the wiser? Can search engines have something agains this
solution?

Best regards
Cah

Apr 9 '07 #3
CAH wrote:
>With mod_rewrite.

With that you can setup Apache to do this:
1) incoming URL:www.site.com/en/page1.php
towww.site.c om/page1.php?lang= en

You can set up your own rules (using regular expression).

In that way you do not have to really create all these pages, but they
become virtual.
You only have to make page1.php pick up the $_GET["lang"] and make
decisions for your query based on that.

Excellent advice, can Google register that one uses mod_rewrite, or is
it none the wiser? Can search engines have something agains this
solution?

Best regards
Cah
Hi,

Searchengine don't know about any url-rewriting taking place.
From a searchengine's point of view:
1) Ask some URL (www.example.com)
2) read all the hyperlinks
3) follow a hyperlink, eg: www.example.com/en/page1.php
4) Server responds with the HTML.
etc

The fact that the server in step 3 using URL rewriting (and actually uses
www.example.com/page1.php?lang=en) is completely unknown to the searchbot.
It is completely unknown to ANY client.
It is just something between you and your friend Apache. ;-)

Regards,
Erwin Moller
Apr 10 '07 #4
CAH wrote:
I need to make at multilanguage language site, and for that I need to
identify the users, and register there choice off language.
I urge you to also inspect the user's "Accept-Language" HTTP header to
determine the default language to show them if they haven't already chosen
a preferred language.

This HTTP header is sent by virtually all web browsers and more often than
not, indicates the user's preferred language.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Apr 10 '07 #5
CAH
On Apr 10, 2:16 pm, Erwin Moller
<since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
CAH wrote:
With mod_rewrite.
With that you can setup Apache to do this:
1) incoming URL:www.site.com/en/page1.php
towww.site.com/page1.php?lang= en
You can set up your own rules (using regular expression).
In that way you do not have to really create all these pages, but they
become virtual.
You only have to make page1.php pick up the $_GET["lang"] and make
decisions for your query based on that.
Excellent advice, can Google register that one uses mod_rewrite, or is
it none the wiser? Can search engines have something agains this
solution?
Best regards
Cah

Hi,

Searchengine don't know about any url-rewriting taking place.
From a searchengine's point of view:
1) Ask some URL (www.example.com)
2) read all the hyperlinks
3) follow a hyperlink, eg:www.example.com/en/page1.php
4) Server responds with the HTML.
etc

The fact that the server in step 3 using URL rewriting (and actually useswww.example .com/page1.php?lang= en) is completely unknown to the searchbot.
It is completely unknown to ANY client.
It is just something between you and your friend Apache. ;-)

Regards,
Erwin Moller- Hide quoted text -

- Show quoted text -
Hi Erwin

It is indeed excellent, I am trying to figure this mod_rewrite out,
and I have gotten it to work with simple request. But I guess it most
be possible with just three lines in the htacces file. I would like
anything in the /en/ directory to just be moved to the above level and
have the everything after the /en/ moved up a level.

RewriteRule /subdic/en/() /subdic.php/$1?lang=en
RewriteRule /subdic/de/() /subdic.php/$1?lang=de
RewriteRule /subdic/dk/() /subdic.php/$1?lang=dk

I am trying to figure it out, can I make it work with sessions id -
PHPSESSID and all the rest?

Best regards
Cah
Apr 10 '07 #6
CAH
On Apr 10, 5:00 pm, Toby A Inkster <usenet200...@t obyinkster.co.u k>
wrote:
CAH wrote:
I need to make at multilanguage language site, and for that I need to
identify the users, and register there choice off language.

I urge you to also inspect the user's "Accept-Language" HTTP header to
determine the default language to show them if they haven't already chosen
a preferred language.

This HTTP header is sent by virtually all web browsers and more often than
not, indicates the user's preferred language.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Hi Toby

Thanks for the advice.
Best regards
Cah

Apr 10 '07 #7
CAH wrote:
On Apr 10, 2:16 pm, Erwin Moller
<since_humans_r ead_this_I_am_s pammed_too_m... @spamyourself.c omwrote:
>CAH wrote:
>With mod_rewrite.
>With that you can setup Apache to do this:
1) incoming URL:www.site.com/en/page1.php
towww.site.c om/page1.php?lang= en
>You can set up your own rules (using regular expression).
>In that way you do not have to really create all these pages, but they
become virtual.
You only have to make page1.php pick up the $_GET["lang"] and make
decisions for your query based on that.
Excellent advice, can Google register that one uses mod_rewrite, or is
it none the wiser? Can search engines have something agains this
solution?
Best regards
Cah

Hi,

Searchengine don't know about any url-rewriting taking place.
From a searchengine's point of view:
1) Ask some URL (www.example.com)
2) read all the hyperlinks
3) follow a hyperlink, eg:www.example.com/en/page1.php
4) Server responds with the HTML.
etc

The fact that the server in step 3 using URL rewriting (and actually
useswww.exampl e.com/page1.php?lang= en) is completely unknown to the
searchbot. It is completely unknown to ANY client. It is just something
between you and your friend Apache. ;-)

Regards,
Erwin Moller- Hide quoted text -

- Show quoted text -

Hi Erwin

It is indeed excellent, I am trying to figure this mod_rewrite out,
and I have gotten it to work with simple request. But I guess it most
be possible with just three lines in the htacces file. I would like
anything in the /en/ directory to just be moved to the above level and
have the everything after the /en/ moved up a level.

RewriteRule /subdic/en/() /subdic.php/$1?lang=en
RewriteRule /subdic/de/() /subdic.php/$1?lang=de
RewriteRule /subdic/dk/() /subdic.php/$1?lang=dk

I am trying to figure it out, can I make it work with sessions id -
PHPSESSID and all the rest?
Hi,

RewriteRule /subdic/en/() /subdic.php/$1?lang=en

What is the () excactly matching?
I am no REGEX wizard myself, but you can write that better, and in 1 rule.

I could be wrong, but what about:

RewriteRule /subdic/(en|de|dk)/(.*)$ /subdic.php/$2?lang=$1

(en|de|dk) <-- in $1
(.*)$ <-- The $ matches end-of-line. So $2 will contain the original
scriptname.

If you are passing more information in the URL, you need to adjust the
regexp to catch that too and make a good URL (with ? and &)

eg:
incoming URL:
http://www.example.com/subdic/en/page1.php?name=CAH

you want that translated into:
http://www.example.com/subdic/page1....me=CAH&lang=en

And:
http://www.example.com/subdic/en/page1.php
should be:
http://www.example.com/subdic/page1.php?lang=en

So you need to add more logic for the ? and &.

But as I stated before: I am no regexp wizard, so ask somebody else for help
on them. ;-)

Good luck.

Regards,
Erwin Moller

>
Best regards
Cah
Apr 11 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3029
by: Mik Foggin | last post by:
Hi, Having spent my free time over the last few months converting several hundred pages of mainly static (s)html into eight pages of data driven php loveliness and a whopping MySQL database I'm faced with a bit of a dilemma. Will search engines be able to crawl all the index.php?query paths so people can find stuff? I'm currently at the top of the heap on Google as my site has been around for years and is pretty niche and I don't want...
1
1368
by: WindAndWaves | last post by:
Hi Gurus How do I provide links that search engines can follow if my site is created in PHP and MySql and I always put the session ID in the link (header)? Are there any special tricks? Basically, I want the search engines to be able to find my pages. Do you need to know more, please ask. Cheers
24
4567
by: Kanthi Kiran Narisetti | last post by:
Hi All, I am Windows Systems Administrator(planning to migrate to Linux administration in near future), I have occassionally written few batch files and Vbscripts to automate my tasks. Now I have strong interest to learn a programming language that would help me to write Scripts or Application ( In Systems Administrative point of view) .
4
4123
by: prschmid | last post by:
I am currently creating a multi-language site using ASP .NET and was wondering what people think the best way to do this. Keeping a session variable of the users's choice? Cookies? Thank you in advance for any advice, comments, help.
4
1561
by: Miguel Dias Moura | last post by:
Hello, I launched a web site some time ago and i am having problems in making it visible in the search engines. I used a lot of Keywords, not only in text but also in links, page and image names. I have 2 questions: 1. Can you tell me what else can i do?
27
2221
by: Bernard Bourée | last post by:
Is there a way to overpass the impossibility of VN.NET to accept the multi heritage, that is to allow a class to inherit from TWO mother classes ? -- Bernard Bourée bernard@bouree.net
5
2496
by: Martien van Wanrooij | last post by:
I have been using phpdig in some websites but now I stored a lot of larger texts into a mysql database. In the phpdig search engine, when you entered a search word, the page where the search word was found was displayed with about 2 lines before and 2 lines behind the search word itself. Let us say you look for "peanut butter" an the word is found in a larger text about sandwiches, even when it is on the 40th line of the text you would get...
71
4861
by: Murray R. Van Luyn | last post by:
Hi, Since I have made changes to my website it's been a complete flop. According to the logs, as soon as visitors have downloaded the index page they are off. I can't figure out why? http://www.review-a-gadget.com/ Is there anything obvious that I am missing? Are there problems with some browsers? Please let me know if you notice anything.
7
1900
by: ThunderMusic | last post by:
Hi, Ok, I find myself having a lot of troubles with URL Rewriting and I've seen on the net that in some situations, indexers have difficulty indexing sites because of some flaws in the url rewriting mecanism... Does anybody have a solution to my problem? I mean, I want to be able to localize my web site without having to dupplicate all the pages in 2-3 (fr, en, sp(optional)) directories and so the indexers can index the right content...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10221
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.