I want to do no redirect of a request if a custom header is set (just proceed the request as it is). The htaccess part of that look like the following:
RewriteBase /
RewriteCond %{HTTP:My-Header} !=1
RewriteRule ^somefolder/(.*)$ /someAuthentication.php&url=$1 [QSA,R=302,L]
The authentication where the header is set:
header('HTTP/1.1 307 Temporary Redirect'); // ...to prevent browser caching of redirects
header('My-Header: 1');
header('Location: /somefolder/' . $_GET['url']); // ... redirect to previously requested file
But if I e.g. redirect to some other script there and check the existing headers with getallheaders(), it seems like My-Header was not send as request header what explains why i am just getting ERR_TOO_MANY_REDIRECTS.
Do i misunderstand the usage / definition of headers, set the header incorrectly or is the htaccess condition faulty? Because in my opinion it should be correct as it is, like:
request file
-> if header set
-> ignore redirect (pass through)
-> if header is not set
-> redirect
-> set header
-> redirect to request file