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.
 
Sorry if 'Profile Badge' is not the correct term. I have an MS 365 subscription and I've noticed on my Word documents the small circle with my initials in it is sometimes different in colour document to document (it's the circle at the top right of the doc, that, when you hover over it it tells you you're signed in; if you click on it you get a bit more info). Last night I had four docs with a red circle, one with blue. When I closed the blue and opened it again it was red. Today I have 3...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...

Similar threads

Replies
7
Views
9K
Back
Top