Apache 2.2 mod_rewrite question

  • Thread starter Thread starter Paolo Cera
  • Start date Start date
  • Tags Tags
    apache
AI Thread Summary
The discussion revolves around the proper syntax for using Apache's mod_rewrite to check for a substring in a cookie based on the request URI. The user initially attempted to create a rewrite condition using a combination of the HTTP_COOKIE and REQUEST_URI variables but faced issues with syntax. They discovered that the problem was related to local backreferences, which are only supported on POSIX 1003.2+ compliant operating systems. The user found that using \N for backreferences worked, while the bind name /N$ did not. This insight aims to help others avoid similar pitfalls in their mod_rewrite configurations.
Paolo Cera
Messages
2
Reaction score
0
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:
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.
 
Computer science news on Phys.org
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.
 
This week, I saw a documentary done by the French called Les sacrifiés de l'IA, which was presented by a Canadian show Enquête. If you understand French I recommend it. Very eye-opening. I found a similar documentary in English called The Human Cost of AI: Data workers in the Global South. There is also an interview with Milagros Miceli (appearing in both documentaries) on Youtube: I also found a powerpoint presentation by the economist Uma Rani (appearing in the French documentary), AI...

Similar threads

Replies
7
Views
9K
Back
Top