Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

How to use the RewriteRule ?

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  Newbie Virtual host questions  
Author Message
Tschuß

External


Since: Jan 20, 2008
Posts: 5



(Msg. 1) Posted: Sun Jan 20, 2008 9:18 am
Post subject: How to use the RewriteRule ?
Archived from groups: alt>apache>configuration (more info?)

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 Sad

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

bye

 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
Tschuß

External


Since: Jan 20, 2008
Posts: 5



(Msg. 2) Posted: Sun Jan 20, 2008 10:12 am
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
Tschuß

External


Since: Jan 20, 2008
Posts: 5



(Msg. 3) Posted: Sun Jan 20, 2008 12:33 pm
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 20, 8:19 pm, "HansH" <ha... DeleteThis @invalid.invalid> wrote:
> "Tschuß" <fleg... DeleteThis @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.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 ?
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
Tschuß

External


Since: Jan 20, 2008
Posts: 5



(Msg. 4) Posted: Sun Jan 20, 2008 1:56 pm
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 20 jan, 22:17, "HansH" <ha....DeleteThis@invalid.invalid> wrote:
> "Tschuß" <fleg....DeleteThis@gmail.com> schreef in berichtnews:0ec084ff-3ddb-41a6-a946-c6ad931948ae@h11g2000prf.googlegroups.com...
>
> > On Jan 20, 8:19 pm, "HansH" <ha....DeleteThis@invalid.invalid> 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=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

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
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
HansH

External


Since: Dec 08, 2006
Posts: 162



(Msg. 5) Posted: Sun Jan 20, 2008 6:57 pm
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Tschuß" <fleguen.DeleteThis@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 Sad
>
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
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
Kees Nuyt

External


Since: Oct 25, 2006
Posts: 78



(Msg. 6) Posted: Sun Jan 20, 2008 7:40 pm
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Sun, 20 Jan 2008 10:12:50 -0800 (PST), "Tschuß"
<fleguen.DeleteThis@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 help $25.00/hr. (#524)
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
HansH

External


Since: Dec 08, 2006
Posts: 162



(Msg. 7) Posted: Sun Jan 20, 2008 8:19 pm
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Tschuß" <fleguen DeleteThis @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
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
HansH

External


Since: Dec 08, 2006
Posts: 162



(Msg. 8) Posted: Sun Jan 20, 2008 10:17 pm
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Tschuß" <fleguen.DeleteThis@gmail.com> schreef in bericht
news:0ec084ff-3ddb-41a6-a946-c6ad931948ae@h11g2000prf.googlegroups.com...
> On Jan 20, 8:19 pm, "HansH" <ha....DeleteThis@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.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
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
Kees Nuyt

External


Since: Oct 25, 2006
Posts: 78



(Msg. 9) Posted: Sun Jan 20, 2008 10:17 pm
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

>On Jan 20, 8:19 pm, "HansH" <ha... DeleteThis @invalid.invalid> wrote:
>> "Tschuß" <fleg... DeleteThis @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.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-content-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)
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
HansH

External


Since: Dec 08, 2006
Posts: 162



(Msg. 10) Posted: Sun Jan 20, 2008 11:58 pm
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Tschuß" <fleguen RemoveThis @gmail.com> schreef in bericht
news:9908ac1e-9d33-4c9b-abec-7f344ab3155d@z17g2000hsg.googlegroups.com...
On 20 jan, 22:17, "HansH" <ha... RemoveThis @invalid.invalid> 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
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
Tschuß

External


Since: Jan 20, 2008
Posts: 5



(Msg. 11) Posted: Mon Jan 21, 2008 9:35 am
Post subject: Re: How to use the RewriteRule ? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 20 jan, 23:58, "HansH" <ha... RemoveThis @invalid.invalid> wrote:
> "Tschuß" <fleg... RemoveThis @gmail.com> schreef in berichtnews:9908ac1e-9d33-4c9b-abec-7f344ab3155d@z17g2000hsg.googlegroups.com...
> On 20 jan, 22:17, "HansH" <ha... RemoveThis @invalid.invalid> 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 havehttp://www.excel-exercice.com/index.php?lang=0&var1=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=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

Can you send me your email or MSN by replying me directly ?
 >> Stay informed about: How to use the RewriteRule ? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
how can apache with RewriteRule pass query params to perl .. - I have the following in my httpd.conf: NameVirtualHost 127.0.0.1:80 <VirtualHost 127.0.0.1:80> ServerName 127.0.0.1 RewriteEngine on RewriteLog logs/rewrite.log RewriteLogLevel 9 RewriteMap issuesmap prg:/Users/dev/applications/perl-scripts/ first...

Hotlinking - I have a free site on royalfreehost.com and I wanted to use some of the images on another site - which is hosted on a pay site - by using hotlinking (to reduce bandwidth, ok, I know it's naughty!) It worked at first. After a few days it stopped ..

cgi search engine for Intranet website - I'm looking for a good (and easy to use) search engine for use on an internal website. I need/want it to search only the web pages on the loacl apache server (running on Redhat 9). Want it to be able to search the bodies of the pages for keywords....

Known issues with running Apache and IIS simultaneously? - Hello, My company is considering running Apache and IIS together on one server. I have researched the possibilities of doing this on the web, but I have found little information apart from basic configuration instructions and some known configuration..

Apache+Tomcat+Cocoon - Anyone ever get those 3 latest-stable release ever work? I got Apache+Tomcat works fine. But I can't get Cocoon to work. All I got when I did http://localhost:8080/cocoon is a directory listing. Helps are greatly appreciated. PS: Its too confusing to....
   Web Hosting Problem Solving Community! (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]