mod_rewrite example?

mod_rewrite example?

am 19.01.2008 06:44:56 von Trammel

I've been looking through the mod_rewrite info from here:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewrit erule

I still dont understand how to make something like the following:
www.blah.com/aaa/bbb/ccc.xxx

Get rewritten to say:
www.blah.com/aaa/bbb/script.php?page=ccc.xxx

Could anyone who knows mod_rewrite please give the line needed for the
mod_rewrite to do that so I can take a look at it?

Thanks for reading the post :¬)

Re: mod_rewrite example?

am 19.01.2008 08:37:03 von unknown

Post removed (X-No-Archive: yes)

Re: mod_rewrite example?

am 20.01.2008 04:07:19 von Trammel

"Davide Bianchi" wrote in message
news:slrnfp3a55.34j.davideyeahsure@fogg.onlyforfun.net...
> On 2008-01-19, Trammel wrote:
>> www.blah.com/aaa/bbb/ccc.xxx
>>
>> Get rewritten to say:
>> www.blah.com/aaa/bbb/script.php?page=ccc.xxx
>
> *UNTESTED*
>
> RewriteCond %{REQUEST_URI} /aaa/bbb/.*$
> RewriteRule ^/aaa/bbb/(.*)$ /aaa/bbb/script.php?page=$1
>
> Davide

Thanks. This helps ALOT.

Quick question though:
I noticed there is no ^ in the RewriteCond... was there a certain reason
that Im not aware of - or is it just because its not really needed?

Re: mod_rewrite example?

am 20.01.2008 07:47:26 von Jim Hayter

Davide Bianchi wrote:
> On 2008-01-19, Trammel wrote:
>> www.blah.com/aaa/bbb/ccc.xxx
>>
>> Get rewritten to say:
>> www.blah.com/aaa/bbb/script.php?page=ccc.xxx
>
> *UNTESTED*
>
> RewriteCond %{REQUEST_URI} /aaa/bbb/.*$
> RewriteRule ^/aaa/bbb/(.*)$ /aaa/bbb/script.php?page=$1
>

Ok. It's late and I just finished dealing with a database server that
didn't want to serve.

I don't understand what the RewriteCond above adds to the RewriteRule.
From looking at rewrite logs over the past few years, it appears to me
that the Rule is evaluated and if it matches, any conditions are then
evaluated to determine if the rule should be applied. What does the
condition above add to the process?

Jim

Re: mod_rewrite example?

am 20.01.2008 08:19:37 von unknown

Post removed (X-No-Archive: yes)

Re: mod_rewrite example?

am 20.01.2008 08:21:29 von unknown

Post removed (X-No-Archive: yes)

Re: mod_rewrite example?

am 20.01.2008 12:13:46 von HansH

"Davide Bianchi" schreef in bericht
news:slrnfp5tk1.34p.davideyeahsure@fogg.onlyforfun.net...
> On 2008-01-20, Jim Hayter wrote:
>> I don't understand what the RewriteCond above adds to the RewriteRule.
>> From looking at rewrite logs over the past few years, it appears to me
>> that the Rule is evaluated and if it matches, any conditions are then
>> evaluated to determine if the rule should be applied. What does the
>> condition above add to the process?
>
> It is my understanding that the condition is checked first, and if
> it does not match the rule is not even looked at, but I could be wrong.
>
http://httpd.apache.org/docs/2.2/rewrite/rewrite_tech.html#I nternalRuleset
rules are evaluated first then the conditions in listed order.

Anyway, doing the same thing boht in a rule and again in a condition-when
matching- is a waste.

Hans