Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old July 25th, 2001, 11:17 AM
nemo nemo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 1 nemo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy rewriting URLs by language

I'm not sure if this falls under content negotiation or rule rewriting or both. What I want to do is find out what language they want using content negotiation and then redirect them to my script sending the language as a variable.

Instead of using a bunch of files called index.html.fr, index.html.en, index.html.de I'll use a script like this so that

index.html.en becomes index.php?lang=en
index.html.fr becomes index.php?lang=fr
index.html.de becomes index.php?lang=de

etc., etc., etc.

I imagine you could use the HTTP_ACCEPT_LANGUAGE server variable for the rewriting of the rule, but I haven't found enough documentation to tell me how to do that.

An example would be nice.

Thanks
nemo

Reply With Quote
  #2  
Old July 25th, 2001, 03:28 PM
pippo's Avatar
pippo pippo is offline
A PAtCHy sErver
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Location: Italy
Posts: 410 pippo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Passing the language to a php script is a good idea, example:

/* "Virtual" Page */
/articles/xxx/yy.html
(note about yy:
'en' for english
'it' for italiano
)

could be internal redirected to
/* "Physical" page */
/pages/articles/show.php?lang=yy&id=xxx

I put these rules inside my httpd.conf, my web host will let me modify it :-)).

####short example of internal redirection
RewriteEngine on
RewriteRule ^/articles/([^/]+)/(en|it).html$ /pages/articles/show.php?lang=$2&id=$1 [T=application/x-httpd-php,L]
####customize the rules for your needs

([^/]+), can be customized to fit your needs (only numbers, etc)

This is a simple example that could give you some ideas,
depending of what you want to do and the tools that you have.

More infos about rewrite here:
http://httpd.apache.org/docs/mod/mod_rewrite.html

also if you do a search inside this forum you could found many threads about rewrite...they helped me a lot :-)

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > rewriting URLs by language


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway