Re: RewriteEngine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux