How to use the RewriteRule ?

How to use the RewriteRule ?

am 20.01.2008 18:18:00 von fleguen

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

Re: How to use the RewriteRule ?

am 20.01.2008 18:57:01 von HansH

"Tschuß" schreef in bericht
news:c8c520d0-386f-490d-b2f0-82a2a03c26c6@p69g2000hsa.google groups.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

Re: How to use the RewriteRule ?

am 20.01.2008 19:12:50 von fleguen

> 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 ?

Re: How to use the RewriteRule ?

am 20.01.2008 19:40:53 von Kees Nuyt

On Sun, 20 Jan 2008 10:12:50 -0800 (PST), "Tschuß"
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 help $25.00/hr. (#524)

Re: How to use the RewriteRule ?

am 20.01.2008 20:19:57 von HansH

"Tschuß" schreef in bericht
news:e00a850b-db56-476a-b526-e88e28722a98@v67g2000hse.google groups.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

Re: How to use the RewriteRule ?

am 20.01.2008 21:33:24 von fleguen

On Jan 20, 8:19 pm, "HansH" wrote:
> "Tschuß" schreef in berichtnews:e00a850b-db56-476a-b=
526-e88e28722a98@v67g2000hse.googlegroups.com...>> ... not quite sure what y=
ou 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.php?lang=3D0&var1=3D2-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 ?

Re: How to use the RewriteRule ?

am 20.01.2008 22:17:06 von HansH

"Tschuß" schreef in bericht
news:0ec084ff-3ddb-41a6-a946-c6ad931948ae@h11g2000prf.google groups.com...
> On Jan 20, 8:19 pm, "HansH" 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.php?lang=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.php?lang=0&var1=7-1-1

Am i right or wrong?

HansH

Re: How to use the RewriteRule ?

am 20.01.2008 22:17:35 von Kees Nuyt

On Sun, 20 Jan 2008 12:33:24 -0800 (PST), "Tschuß"
wrote:

>On Jan 20, 8:19 pm, "HansH" wrote:
>> "Tschuß" 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.php?lang=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/2006/06/php-downloads-conte nt-disposition.html

http://www.sitearticles.com/index.php/?m=show&opt=printable& 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)

Re: How to use the RewriteRule ?

am 20.01.2008 22:56:28 von fleguen

On 20 jan, 22:17, "HansH" wrote:
> "Tschuß" schreef in berichtnews:0ec084ff-3ddb-41a6-a=
946-c6ad931948ae@h11g2000prf.googlegroups.com...
>
> > On Jan 20, 8:19 pm, "HansH" wrote:
> > I have created this websitewww.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.php?lang=3D0&var1=3D2-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.php?lang=3D0&var1=3D7-1- 1
>
> Am i right or wrong?
>
> HansH

Wrong !
Now, I have http://www.excel-exercice.com/index.php?lang=3D0&var1=3D7-1- 1
and I want http://www.excel-exercice.com/index.php?what-is-a-macro.html
(and this is in my .htaccess) in my URL

Re: How to use the RewriteRule ?

am 20.01.2008 23:58:21 von HansH

"Tschuß" schreef in bericht
news:9908ac1e-9d33-4c9b-abec-7f344ab3155d@z17g2000hsg.google groups.com...
On 20 jan, 22:17, "HansH" wrote:
>> > So, when you select one item, you have for instance the following URL
>> >http://www.excel-exercice.com/index.php?lang=0&var1=2-1-1
>> >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.php?lang=0&var1=7-1-1
>>
>> Am i right or wrong?
> Wrong !
> Now, I have http://www.excel-exercice.com/index.php?lang=0&var1=7-1-1
> and I want http://www.excel-exercice.com/index.php?what-is-a-macro.html
> (and this is in my .htaccess) in my URL

Sorry, from your previous post I mist
http://www.excel-exercice.com/border-and-pattern.html

which seems inconsistant to the current
http://www.excel-exercice.com/index.php?what-is-a-macro.html

nor fit the suggestion made in your initial post
RewriteRule ^/index\.php?lang=1&var1=plan$ /fr/plan [L,PT]

which looks like you want to rewrite _from_ a dynamic script driven content
_to_ a static file mapping a parameter _directly_ to a folder.


By now I lost both head and tail of your intend.

HansH

Re: How to use the RewriteRule ?

am 21.01.2008 18:35:05 von fleguen

On 20 jan, 23:58, "HansH" wrote:
> "Tschuß" schreef in berichtnews:9908ac1e-9d33-4c9b-a=
bec-7f344ab3155d@z17g2000hsg.googlegroups.com...
> On 20 jan, 22:17, "HansH" wrote:
>
> >> > So, when you select one item, you have for instance the following URL=

> >> >http://www.excel-exercice.com/index.php?lang=3D0&var1=3D2-1 -1
> >> >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.php?lang=3D0&var1=3D7-1- 1
>
> >> Am i right or wrong?
> > Wrong !
> > Now, I havehttp://www.excel-exercice.com/index.php?lang=3D0&var1=3D 7-1-1=

> > and I wanthttp://www.excel-exercice.com/index.php?what-is-a-macro. html
> > (and this is in my .htaccess) in my URL
>
> Sorry, from your previous post I mist
> http://www.excel-exercice.com/border-and-pattern.html
>
> which seems inconsistant to the current
> http://www.excel-exercice.com/index.php?what-is-a-macro.html
>
> nor fit the suggestion made in your initial post
> RewriteRule ^/index\.php?lang=3D1&var1=3Dplan$ /fr/plan [L,PT]
>
> which looks like you want to rewrite _from_ a dynamic script driven conten=
t
> _to_ a static file mapping a parameter _directly_ to a folder.
>
> By now I lost both head and tail of your intend.
>
> HansH

Can you send me your email or MSN by replying me directly ?