Afficher un message
Vieux 20/01/2008, 18h57   #2
HansH
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use the RewriteRule ?

"Tschuß" <fleguen@gmail.com> schreef in bericht
news:c8c520d0-386f-490d-b2f0-82a2a03c26c6@p69g2000hsa.googlegroups.com...
> So have activated this modules
> LoadModule rewrite_module modules/mod_rewrite.so
> AddModule mod_rewrite.c
>
> And my .htaccess
> php_flag register_globals 1
> Options +FollowSymlinks
> RewriteEngine On
> RewriteRule ^$ /HomePage [L,PT]
> RewriteRule ^/index\.php?lang=1$ /fr [L,PT]
> RewriteRule ^/index\.php?lang=0$ /en [L,PT]
> RewriteRule ^/index\.php?lang=1&var1=plan$ /fr/plan [L,PT]
>
> Nothing works
>

IIRC in .htaccess omit the leading /
You need a condition to test each part of the querystring
RewriteCond %{QUERY_STRING} lang=1
RewriteCond %{QUERY_STRING} var1=([^&]+)
RewriteRule ^index\.php$ /fr/%1 [L,PT]

RewriteCond %{QUERY_STRING} lang=1
RewriteRule ^index\.php$ /fr [L,PT]

RewriteCond %{QUERY_STRING} lang=0
RewriteCond %{QUERY_STRING} var1=([^&]+)
RewriteRule ^index\.php$ /en/%1 [L,PT]

RewriteCond %{QUERY_STRING} lang=0
RewriteRule ^index\.php$ /en [L,PT]

If the list of language numbers grows large, consider
a rewritemap -in server config rather than .htaccess-

Some pitfalls ahead, not quite sure what you are after too

HansH


  Réponse avec citation
 
Page generated in 0,11612 seconds with 9 queries