PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > How to use the RewriteRule ?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

How to use the RewriteRule ?

Réponse
 
LinkBack Outils de la discussion
Vieux 20/01/2008, 17h18   #1
Tschuß
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to use the RewriteRule ?

Hi,
I would like to use this option for my website but it doesn't work.

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

What is my pb ?????
So if you have any ideas, please, give me your opinion

bye
  Réponse avec citation
Vieux 20/01/2008, 17h57   #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
Vieux 20/01/2008, 18h12   #3
Tschuß
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use the RewriteRule ?

> IIRC in .htaccess omit the leading /
What that means ? IIRC ????


> 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


I try what you have said but it doesn't work.
Do you have any web adress to have more details about RewriteRule ?
  Réponse avec citation
Vieux 20/01/2008, 18h40   #4
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use the RewriteRule ?

On Sun, 20 Jan 2008 10:12:50 -0800 (PST), "Tschuß"
<fleguen@gmail.com> wrote:

>What that means ? IIRC ????


If I Recall Correctly (= if my memory serves me well)
--
( Kees
)
c[_] Seen on a sign in a mechanic's garage:
Labor $10.00/hr.
If you watch $15.00/hr.
If you $25.00/hr. (#524)
  Réponse avec citation
Vieux 20/01/2008, 19h19   #5
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:e00a850b-db56-476a-b526-e88e28722a98@v67g2000hse.googlegroups.com...
>> ... not quite sure what you are after too

>
> I try what you have said but it doesn't work.

Explain your needs in english,.

> Do you have any web adress to have more details about RewriteRule ?

http://httpd.apache.org/docs/2.2/misc/rewriteguide.html


HansH


  Réponse avec citation
Vieux 20/01/2008, 20h33   #6
Tschuß
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use the RewriteRule ?

On Jan 20, 8:19 pm, "HansH" <ha...@invalid.invalid> wrote:
> "Tschuß" <fleg...@gmail.com> schreef in berichtnews:e00a850b-db56-476a-b526-e88e28722a98@v67g2000hse.googlegroups.com...>> ... not quite sure what you are after too
>
> > I try what you have said but it doesn't work.

>
> Explain your needs in English,.
>

Ok,
I have created this website www.excel-exercice.com
For each item, I have 2 parameters, the language (0 or 1) and the
criteria for the item (1-1-1 ; 3-2-1 ; ......)
So, when you select one item, you have for instance the following URL
http://www.excel-exercice.com/index....g=0&var1=2-1-1 and I would
like to have something like http://www.excel-exercice.com/border-and-pattern..html

I have 155 items for the French language and 46 in English but it
doesn't disturb me to write as many URL in my .htaccess as necessary.

Does these explanations are enough or you need further info ?

  Réponse avec citation
Vieux 20/01/2008, 21h17   #7
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:0ec084ff-3ddb-41a6-a946-c6ad931948ae@h11g2000prf.googlegroups.com...
> On Jan 20, 8:19 pm, "HansH" <ha...@invalid.invalid> wrote:
> I have created this website www.excel-exercice.com
> For each item, I have 2 parameters, the language (0 or 1) and the
> criteria for the item (1-1-1 ; 3-2-1 ; ......)
>
> So, when you select one item, you have for instance the following URL
> http://www.excel-exercice.com/index....g=0&var1=2-1-1
> and I would like to have something like
> http://www.excel-exercice.com/border-and-pattern.html


Given
http://www.excel-exercice.com/en/7-1-1.html
is not working I take it you want it to show like
http://www.excel-exercice.com/index....g=0&var1=7-1-1

Am i right or wrong?

HansH


  Réponse avec citation
Vieux 20/01/2008, 21h17   #8
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to use the RewriteRule ?

On Sun, 20 Jan 2008 12:33:24 -0800 (PST), "Tschuß"
<fleguen@gmail.com> wrote:

>On Jan 20, 8:19 pm, "HansH" <ha...@invalid.invalid> wrote:
>> "Tschuß" <fleg...@gmail.com> schreef in berichtnews:e00a850b-db56-476a-b526-e88e28722a98@v67g2000hse.googlegroups.com...>> ... not quite sure what you are after too
>>
>> > I try what you have said but it doesn't work.

>>
>> Explain your needs in English,.
>>

>Ok,
>I have created this website www.excel-exercice.com
>For each item, I have 2 parameters, the language (0 or 1) and the
>criteria for the item (1-1-1 ; 3-2-1 ; ......)
>So, when you select one item, you have for instance the following URL
>http://www.excel-exercice.com/index....g=0&var1=2-1-1 and I would
>like to have something like http://www.excel-exercice.com/border-and-pattern.html
>
>I have 155 items for the French language and 46 in English but it
>doesn't disturb me to write as many URL in my .htaccess as necessary.
>
>Does these explanations are enough or you need further info ?


Though it might work with rewrites, I would handle it in
PHP, with a database behind it for the mapping of logical
names (border-and-pattern.html) which are in
$_SERVER['PATH_INFO'] to IDs (lang=0&var1=2-1-1).

These articles describe a suitable technique, although it
is applied to different problems:

http://richardlynch.blogspot.com/200...sposition.html

http://www.sitearticles.com/index.ph...rintable&id=18

Of course there are many ways to Rome, I just wanted to
show you this one.
--
( Kees
)
c[_] Life is what happens while you are busy
making other plans..... (John Lennon) (#452)
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h48.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,16985 seconds with 16 queries