hide get variable - query_srting

Discuss practical ways rearrange URLs using mod_rewrite.

hide get variable - query_srting

Postby rufuz » Fri Jan 16, 2009 6:47 pm

I think this could be quite easy with query_string

http://www.mysite.com/any.html?lang=en

rewrite to


http://www.mysite.com/any.html

mantaing transport of lang variable and its value

this rule should be valid for every urls in the domain included the domain itself (e.g. http://www.mysyte.com?lang=en), and the value "en" could be whatever lang code ( es,it,fr,de......).

Is that possible?

thanx richardk!

ricc.
rufuz
 
Posts: 16
Joined: Thu Aug 21, 2008 9:56 am

Postby richardk » Sat Jan 17, 2009 6:20 pm

You can't hide something that changes, how will mod_rewrite know what value you want?

Either add it into the URL (eg. /en/abc.html)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Default to /en/.
RewriteRule !^(de|en|es|fr|it)(/.*)?$ /en%{REQUEST_URI} [R=301,L]

RewriteRule ^(de|en|es|fr|it)(/(.*))?$ /$3?lang$1 [QSA,L]


Or use a cookie.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby rufuz » Mon Jan 19, 2009 11:20 am

thx richardk!
rufuz
 
Posts: 16
Joined: Thu Aug 21, 2008 9:56 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 19 guests

cron