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

mod_rewrite example?

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  IIS7 Support for ISAPI Filters  
Author Message
Trammel

External


Since: Jan 13, 2008
Posts: 9



(Msg. 1) Posted: Sat Jan 19, 2008 2:04 am
Post subject: mod_rewrite example?
Archived from groups: alt>apache>configuration (more info?)

I've been looking through the mod_rewrite info from here:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#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 :¬)

 >> Stay informed about: mod_rewrite example? 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2994



(Msg. 2) Posted: Sat Jan 19, 2008 5:07 am
Post subject: Re: mod_rewrite example? [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

This message is not archived

 >> Stay informed about: mod_rewrite example? 
Back to top
Login to vote
Jim Hayter

External


Since: Feb 07, 2005
Posts: 98



(Msg. 3) Posted: Sun Jan 20, 2008 1:47 am
Post subject: Re: mod_rewrite example? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Davide Bianchi wrote:
> On 2008-01-19, Trammel <Me.TakeThisOut@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
 >> Stay informed about: mod_rewrite example? 
Back to top
Login to vote
Trammel

External


Since: Jan 13, 2008
Posts: 9



(Msg. 4) Posted: Sun Jan 20, 2008 3:07 am
Post subject: Re: mod_rewrite example? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Davide Bianchi" <davideyeahsure.TakeThisOut@onlyforfun.net> wrote in message
news:slrnfp3a55.34j.davideyeahsure@fogg.onlyforfun.net...
> On 2008-01-19, Trammel <Me.TakeThisOut@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?
 >> Stay informed about: mod_rewrite example? 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2994



(Msg. 5) Posted: Sun Jan 20, 2008 8:19 am
Post subject: Re: mod_rewrite example? [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2994



(Msg. 6) Posted: Sun Jan 20, 2008 8:21 am
Post subject: Re: mod_rewrite example? [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
HansH

External


Since: Dec 08, 2006
Posts: 162



(Msg. 7) Posted: Sun Jan 20, 2008 12:13 pm
Post subject: Re: mod_rewrite example? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Davide Bianchi" <davideyeahsure RemoveThis @onlyforfun.net> schreef in bericht
news:slrnfp5tk1.34p.davideyeahsure@fogg.onlyforfun.net...
> On 2008-01-20, Jim Hayter <see.reply.to RemoveThis @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/rewrite/rewrite_tech.html#InternalRuleset
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
 >> Stay informed about: mod_rewrite example? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
mod_rewrite directory - Hi, I am using mod_rewrite to re-direct all requests to a directory to a .php script using a set of commands similar to: RewriteEngine on RewriteRule !\.(gif|jpg|png|css)$ ../some_dir/handler.php [T=application/x-httpd-php] These reside within a..

Mod_rewrite Problems - Hey All, I am running a Fedora Core 3 server, with Apache/2.0.53 and PHP/ 4.3.11, with each user having their own folder under the server (ie '/ home/userOne/public_html' = 'server.com/~userOne') I am trying to get the mod_rewrite module to work for me...

problems with php and mod_rewrite - When Apache starts I get the message "PHP startup: unable to load the dynamic library: 'c:\program files\php \ext\php_exif.dll' - The specified module could not be found." Also I want to enable mod_rewrite, as per cakephp manual, with the line...

Yet Another mod_rewrite SSL Question... - Hey Guys, I'm having an interesting issue with redirecting http traffic to https using mod_rewrite. First, I'll explain my setup a little bit. I'm running Apache 2.0.52 on Redhat. I basically have something that looks like this: Listen 80 Listen..

mod_rewrite dynamic directories - Hello all, Ihave a site that has dynamic kiosk stores and I can't seem to get everything to work how I want it to. 1. I need url.com/kiosk_name going to url.com/store/index.php? kiosk=kiosk_name (which I have that so far). 2. I need..
   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 ]