How to do it? RewriteCond% {ENV: UNIQUE_ID}!% {QUERY_STRING}

/foo/.htaccess internally redirects

RewriteRule ^(.*)$ /bar/?%{ENV:UNIQUE_ID}

/bar/.htaccess must admit that the request was not internal, the problem is that I cannot figure out how to make the comparison work

RewriteCond %{ENV:UNIQUE_ID} !%{QUERY_STRING}

even a

RewriteCond %{QUERY_STRING} %{QUERY_STRING}

will not match, I believe there is a syntax problem on the right side of the expression, the escape code doesn't help.

I tested that the above both variables have the same value with internal redirection as

RewriteRule ^(.*)$ /test/%{QUERY_STRING}/%{ENV:UNIQUE_ID} 

will show it.

Apache Server / 2.2.3

Thanks Laurian

+5
source share
2 answers

Unfortunately, you cannot compare two variables directly with mod_rewrite. (Or at least I don't know how to do this.)

:

RewriteCond %{ENV:UNIQUE_ID}:%{QUERY_STRING} !^(.+):\1$

: , , . UNIQUE_ID, .

+15

, , , , -, HTTP_REFERRER. .

0

All Articles