httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Leal <>
Subject Re: [users@httpd] RewriteEngine
Date Sat, 05 May 2007 21:57:42 GMT
Joshua Slive wrote:
> Davi Leal wrote:
> > Does the rewrite engine not take into account the URI parameters?  I get:
> >
> >   init rewrite engine with requested uri /offers
> >
> > instead of
> >
> >   init rewrite engine with requested uri /offers?id=9
> In the docs for RewriteRule, see the big box marked "Query String".

There are complex cases which I am unable to realize with modrewrite. See the 
Appendix. As an example:


    if "?id=XXX" is present  go to  View_Offer.php
    else                     go to  List_All_Offers.php


  RewriteCond %{THE_REQUEST} ^.*/offers.*.id=.*$
  RewriteRule ^/offers([?id=]*)(.*) /View_Offer.php?OfferId=$2

  RewriteCond %{REQUEST_URI} ^.*
  RewriteRule ^/offers$ /List_All_Offers.php$1

Steps realized by the Apache modrewrite:

  init rewrite engine with requested uri /offers

  applying pattern '^/offers([?id=]*)(.*)' to uri '/offers'

  RewriteCond: input='GET /offers?id=9 HTTP/1.1'
               pattern='^.*/offers.*.id=.*$' => matched

  rewrite '/offers' -> '/View_Offer.php?OfferId='

  split uri=/View_Offer.php?OfferId= -> uri=/View_Offer.php,

The problem is that the Apache modrewrite gets always "/offers" as requested 
uri both when we request
and too when we request
so, the below rewrite rule gets an empty $2 value. Therefore the webapp can 
not work.

    RewriteRule ^/offers([?id=]*)(.*) /View_Offer.php?OfferId=$2

Let me know if I am mistaken,


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message