httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Leal <d...@leals.com>
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:

  /offers

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



Appendix
========

  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,
                                               args=OfferId=


The problem is that the Apache modrewrite gets always "/offers" as requested 
uri both when we request     gnuherds.org/offers?id=9
and too when we request      gnuherds.org/offers
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,

Davi

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message