mod_rewrite example?

This is a discussion on mod_rewrite example? within the Apache Web Server forums, part of the Web Server and Related Forums category; I've been looking through the mod_rewrite info from here: http://httpd.apache.org/docs/2.2/mod...ml#rewriterule ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008
Trammel
 
Posts: n/a
Default mod_rewrite example?

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

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 :¬)


  #2 (permalink)  
Old 01-20-2008
Trammel
 
Posts: n/a
Default Re: mod_rewrite example?

"Davide Bianchi" <davideyeahsure@onlyforfun.net> wrote in message
news:slrnfp3a55.34j.davideyeahsure@fogg.onlyforfun .net...
> On 2008-01-19, Trammel <Me@Server.com> 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?


  #3 (permalink)  
Old 01-20-2008
Jim Hayter
 
Posts: n/a
Default Re: mod_rewrite example?

Davide Bianchi wrote:
> On 2008-01-19, Trammel <Me@Server.com> 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
  #4 (permalink)  
Old 01-20-2008
HansH
 
Posts: n/a
Default Re: mod_rewrite example?

"Davide Bianchi" <davideyeahsure@onlyforfun.net> schreef in bericht
news:slrnfp5tk1.34p.davideyeahsure@fogg.onlyforfun .net...
> On 2008-01-20, Jim Hayter <see.reply.to@nowhere.invalid> 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/rew...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


 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 11:53 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0