Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Apache 2.2 mod_rewrite question

  1. Mar 24, 2008 #1
    Anyone know of the proper syntax that captures this metaphor?

    Given a Cookie and URI, I would like to check for the existence of a substring in the cookie in the URI and then proceed to a rewrite rule accordingly.

    Here's an example of my reasoning

    Code (Text):
    RewriteEngine on


    RewriteCond %{HTTP_COOKIE},%{REQUEST_URI} .*xXx(.+)xXx.*,.*$1.*
    RewriteRule blah,blah,blah
    I would suspect something likes this is syntactically correct, but repeated testing proves me wrong. Any help would be appreciated.
  2. jcsd
  3. Mar 24, 2008 #2
    Got the answer to this. Turns out that I'm trying to do something called a local backreference, and the solution is only portable to POSIX 1003.2+ compliant OSes. More on it can be found here.

    Note, the bind name /N$ (where 0 < N < 9) did not work for me, but \N did.

    Anyways, hope this doesn't trip up anyone else in the future.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook