FREE THOUGHT · FREE SOFTWARE · FREE WORLD

View Your Server Environment Variables using Htaccess Mod_Rewrite

PHP Script to View Variables

array(), 'HTTP'=>array(), 'ENV'=>array() );
foreach($_SERVER as $v=>$r)
{
	if(empty($r))continue;
  if(substr($v,0,6)=='HTTP_I') {
	  if(substr($v,0,10)=='HTTP_INFOE') $ENV[substr($v,11)]=$r;
	  elseif(substr($v,0,10)=='HTTP_INFOH') $HTTP[substr($v,11)]=$r;
		else $INFO[substr($v,10)]=$r;
	}
}

ksort($ENV);
ksort($INFO);
ksort($HTTP);

echo "nReceived (".sizeof($ENV).") ENV Variables:n";
print_r($ENV);

echo "nReceived (".sizeof($HTTP).") HTTP Variables:n";
print_r($HTTP);

echo "nReceived (".sizeof($INFO).") INFO Variables:n";
print_r($INFO);

Setup Htaccess File

Options +FollowSymLinks +ExecCGI
DirectoryIndex /cgi-bin/rewrite-test/index.php

Extending with ErrorDocument

ErrorDocument 100 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=100
ErrorDocument 101 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=101
ErrorDocument 102 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=102
ErrorDocument 200 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=200
ErrorDocument 201 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=201
ErrorDocument 202 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=202
ErrorDocument 203 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=203
ErrorDocument 204 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=204
ErrorDocument 205 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=205
ErrorDocument 206 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=206
ErrorDocument 207 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=207
ErrorDocument 300 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=300
ErrorDocument 301 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=301
ErrorDocument 302 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=302
ErrorDocument 303 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=303
ErrorDocument 304 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=304
ErrorDocument 305 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=305
ErrorDocument 306 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=306
ErrorDocument 307 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=307
ErrorDocument 400 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=400
ErrorDocument 401 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=401
ErrorDocument 402 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=402
ErrorDocument 403 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=403
ErrorDocument 404 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=404
ErrorDocument 405 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=405
ErrorDocument 406 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=406
ErrorDocument 407 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=407
ErrorDocument 408 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=408
ErrorDocument 409 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=409
ErrorDocument 410 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=410
ErrorDocument 411 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=411
ErrorDocument 412 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=412
ErrorDocument 413 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=413
ErrorDocument 414 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=414
ErrorDocument 415 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=415
ErrorDocument 416 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=416
ErrorDocument 417 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=417
ErrorDocument 418 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=418
ErrorDocument 419 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=419
ErrorDocument 420 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=420
ErrorDocument 421 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=421
ErrorDocument 422 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=422
ErrorDocument 423 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=423
ErrorDocument 424 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=424
ErrorDocument 425 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=425
ErrorDocument 426 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=426
ErrorDocument 500 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=500
ErrorDocument 501 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=501
ErrorDocument 502 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=502
ErrorDocument 503 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=503
ErrorDocument 504 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=504
ErrorDocument 505 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=505
ErrorDocument 506 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=506
ErrorDocument 507 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=507
ErrorDocument 508 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=508
ErrorDocument 509 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=509
ErrorDocument 510 /cgi-bin/php/pro/rewrite-test/index.php?errordocument=510

SetEnvIfNoCase to Set Variables

If starting with ^ it grabs the HTTP Header, so ^Cache-Control contains the Cache-Control Header sent by the requesting agent (your browser). Otherwise, it grabs the value of a special variable available only to SetEnvIf - Server_Addr, Request_Method, etc., are examples.

SetEnvIfNoCase ^Authorization$ ".+username="(.+)",.+" REMOTE_USER=$1
SetEnvIfNoCase ^Authorization$ ".+username="(.+)",.+" PHP_AUTH_DIGEST=$1
SetEnvIfNoCase Server_Addr "(.+)" SERVER_ADDR=$1
SetEnvIfNoCase Request_Method "(.+)" REQUEST_METHOD=$1
SetEnvIfNoCase Request_Protocol "(.+)" INFO_REQUEST_PROTOCOL=$1
SetEnvIfNoCase ^Cache-Control$ "(.+)" INFO_CACHE_CONTROL=$1
SetEnvIfNoCase Request_URI "(.+)" REQUEST_URI=$1
SetEnvIfNoCase ^WWW-Auth "(.+)" HTTP_WWW_AUTHORIZATION=$1
SetEnvIfNoCase ^If "(.+)" HTTP_IF_MODIFIED_SINCE=$1
SetEnvIfNoCase ^If-None-Match$ "(.+)" HTTP_IF_NONE_MATCH=$1
SetEnvIfNoCase ^Connection$ "(.+)" HTTP_CONNECTION=$1
SetEnvIfNoCase ^Keep-Alive$ "(.+)" HTTP_KEEP_ALIVE=$1
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
SetEnvIfNoCase ^Content-Type$ "(.+)" HTTP_CONTENT_TYPE=$1
SetEnvIfNoCase ^Content-Length$ "(.+)" HTTP_CONTENT_LENGTH=$1
RewriteEngine On
RewriteBase /

# VARIABLES FROM THE HTTP HEADERS
RewriteRule .* - [E=INFOH_AUTHORIZATION:%{HTTP:Authorization},NE]
RewriteRule .* - [E=INFOH_AUTHENTICATION_INFO:%{HTTP:Authentication-Info},NE]
RewriteRule .* - [E=INFOH_CACHE_CONTROL:%{HTTP:Cache-Control},NE]
RewriteRule .* - [E=INFOH_CONNECTION:%{HTTP:Connection},NE]
RewriteRule .* - [E=INFOH_ACCEPT:%{HTTP:Accept},NE]
RewriteRule .* - [E=INFOH_ACCEPT_CHARSET:%{HTTP:Accept-Charset},NE]
RewriteRule .* - [E=INFOH_ACCEPT_ENCODING:%{HTTP:Accept-Encoding},NE]
RewriteRule .* - [E=INFOH_ACCEPT_LANGUAGE:%{HTTP:Accept-Language},NE]
RewriteRule .* - [E=INFOH_COOKIE:%{HTTP:Cookie},NE]
RewriteRule .* - [E=INFOH_FORWARDED:%{HTTP:Forwarded},NE]
RewriteRule .* - [E=INFOH_HOST:%{HTTP:HOST},NE]
RewriteRule .* - [E=INFOH_KEEP_ALIVE:%{HTTP:Keep-Alive},NE]
RewriteRule .* - [E=INFOH_TRANSFER_ENCODING:%{HTTP:Transfer-Encoding},NE]
RewriteRule .* - [E=INFOH_PROXY_CONNECTION:%{HTTP:Proxy-Connection},NE]
RewriteRule .* - [E=INFOH_REFERER:%{HTTP:REFERER},NE]
RewriteRule .* - [E=INFOH_USER_AGENT:%{HTTP:User-Agent},NE]

# VARIABLES FROM THE ENV ENVIRONMENT
RewriteRule .* - [E=INFOE_PATH:%{ENV:PATH},NE]
RewriteRule .* - [E=INFOE_SCRIPT_URI:%{ENV:SCRIPT_URI},NE]
RewriteRule .* - [E=INFOE_SCRIPT_URL:%{ENV:SCRIPT_URL},NE]
RewriteRule .* - [E=INFOE_UNIQUE_ID:%{ENV:UNIQUE_ID},NE]
RewriteRule .* - [E=INFOE_PHP_AUTH_DIGEST:%{ENV:PHP_AUTH_DIGEST},NE]
RewriteRule .* - [E=INFOE_HTTP_ACCEPT:%{ENV:HTTP_ACCEPT},NE]
RewriteRule .* - [E=INFOE_HTTP_ACCEPT_CHARSET:%{ENV:HTTP_ACCEPT_CHARSET},NE]
RewriteRule .* - [E=INFOE_HTTP_ACCEPT_ENCODING:%{ENV:HTTP_ACCEPT_ENCODING},NE]
RewriteRule .* - [E=INFOE_HTTP_ACCEPT_LANGUAGE:%{ENV:HTTP_ACCEPT_LANGUAGE},NE]
RewriteRule .* - [E=INFOE_HTTP_COOKIE:%{ENV:HTTP_COOKIE},NE]
RewriteRule .* - [E=INFOE_HTTP_FORWARDED:%{ENV:HTTP_FORWARDED},NE]
RewriteRule .* - [E=INFOE_HTTP_HOST:%{ENV:HTTP_HOST},NE]
RewriteRule .* - [E=INFOE_HTTP_KEEP_ALIVE:%{ENV:HTTP_KEEP_ALIVE},NE]
RewriteRule .* - [E=INFOE_HTTP_PROXY_CONNECTION:%{ENV:HTTP_PROXY_CONNECTION},NE]
RewriteRule .* - [E=INFOE_HTTP_REFERER:%{ENV:HTTP_REFERER},NE]
RewriteRule .* - [E=INFOE_HTTP_USER_AGENT:%{ENV:HTTP_USER_AGENT},NE]
RewriteRule .* - [E=INFOE_AUTH_TYPE:%{ENV:AUTH_TYPE},NE]
RewriteRule .* - [E=INFOE_CONTENT_LENGTH:%{ENV:CONTENT_LENGTH},NE]
RewriteRule .* - [E=INFOE_CONTENT_TYPE:%{ENV:CONTENT_TYPE},NE]
RewriteRule .* - [E=INFOE_DATE_GMT:%{ENV:DATE_GMT},NE]
RewriteRule .* - [E=INFOE_DATE_LOCAL:%{ENV:DATE_LOCAL},NE]
RewriteRule .* - [E=INFOE_DOCUMENT_NAME:%{ENV:DOCUMENT_NAME},NE]
RewriteRule .* - [E=INFOE_DOCUMENT_PATH_INFO:%{ENV:DOCUMENT_PATH_INFO},NE]
RewriteRule .* - [E=INFOE_DOCUMENT_ROOT:%{ENV:DOCUMENT_ROOT},NE]
RewriteRule .* - [E=INFOE_DOCUMENT_URI:%{ENV:DOCUMENT_URI},NE]
RewriteRule .* - [E=INFOE_REMOTE_ADDR:%{ENV:REMOTE_ADDR},NE]
RewriteRule .* - [E=INFOE_REMOTE_HOST:%{ENV:REMOTE_HOST},NE]
RewriteRule .* - [E=INFOE_REMOTE_IDENT:%{ENV:REMOTE_IDENT},NE]
RewriteRule .* - [E=INFOE_REMOTE_PORT:%{ENV:REMOTE_PORT},NE]
RewriteRule .* - [E=INFOE_REMOTE_USER:%{ENV:REMOTE_USER},NE]
RewriteRule .* - [E=INFOE_REDIRECT_HANDLER:%{ENV:REDIRECT_HANDLER},NE]
RewriteRule .* - [E=INFOE_REDIRECT_QUERY_STRING:%{ENV:REDIRECT_QUERY_STRING},NE]
RewriteRule .* - [E=INFOE_REDIRECT_REMOTE_USER:%{ENV:REDIRECT_REMOTE_USER},NE]
RewriteRule .* - [E=INFOE_REDIRECT_STATUS:%{ENV:REDIRECT_STATUS},NE]
RewriteRule .* - [E=INFOE_REDIRECT_URL:%{ENV:REDIRECT_URL},NE]
RewriteRule .* - [E=INFOE_REQUEST_METHOD:%{ENV:REQUEST_METHOD},NE]
RewriteRule .* - [E=INFOE_REQUEST_URI:%{ENV:REQUEST_URI},NE]
RewriteRule .* - [E=INFOE_REQUEST_FILENAME:%{ENV:REQUEST_FILENAME},NE]
RewriteRule .* - [E=INFOE_REQUEST_TIME:%{ENV:REQUEST_TIME},NE]
RewriteRule .* - [E=INFOE_SCRIPT_FILENAME:%{ENV:SCRIPT_FILENAME},NE]
RewriteRule .* - [E=INFOE_SCRIPT_NAME:%{ENV:SCRIPT_NAME},NE]
RewriteRule .* - [E=INFOE_SCRIPT_GROUP:%{ENV:SCRIPT_GROUP},NE]
RewriteRule .* - [E=INFOE_SCRIPT_USER:%{ENV:SCRIPT_USER},NE]
RewriteRule .* - [E=INFOE_SCRIPT_URI:%{ENV:SCRIPT_URI},NE]
RewriteRule .* - [E=INFOE_SCRIPT_URL:%{ENV:SCRIPT_URL},NE]
RewriteRule .* - [E=INFOE_SERVER_ADMIN:%{ENV:SERVER_ADMIN},NE]
RewriteRule .* - [E=INFOE_SERVER_NAME:%{ENV:SERVER_NAME},NE]
RewriteRule .* - [E=INFOE_SERVER_ADDR:%{ENV:SERVER_ADDR},NE]
RewriteRule .* - [E=INFOE_SERVER_PORT:%{ENV:SERVER_PORT},NE]
RewriteRule .* - [E=INFOE_SERVER_PROTOCOL:%{ENV:SERVER_PROTOCOL},NE]
RewriteRule .* - [E=INFOE_SERVER_SIGNATURE:%{ENV:SERVER_SIGNATURE},NE]
RewriteRule .* - [E=INFOE_SERVER_SOFTWARE:%{ENV:SERVER_SOFTWARE},NE]
RewriteRule .* - [E=INFOE_GATEWAY_INTERFACE:%{ENV:GATEWAY_INTERFACE},NE]
RewriteRule .* - [E=INFOE_LAST_MODIFIED:%{ENV:LAST_MODIFIED},NE]
RewriteRule .* - [E=INFOE_PATH_INFO:%{ENV:PATH_INFO},NE]
RewriteRule .* - [E=INFOE_PATH_TRANSLATED:%{ENV:PATH_TRANSLATED},NE]
RewriteRule .* - [E=INFOE_QUERY_STRING:%{ENV:QUERY_STRING},NE]
RewriteRule .* - [E=INFOE_QUERY_STRING_UNESCAPED:%{ENV:QUERY_STRING_UNESCAPED},NE]
RewriteRule .* - [E=INFOE_USER_NAME:%{ENV:USER_NAME},NE]
RewriteRule .* - [E=INFOE_TZ:%{ENV:TZ},NE]
RewriteRule .* - [E=INFOE_API_VERSION:%{ENV:API_VERSION},NE]
RewriteRule .* - [E=INFOE_HTTPS:%{ENV:HTTPS},NE]
RewriteRule .* - [E=INFOE_IS_SUBREQ:%{ENV:IS_SUBREQ},NE]
RewriteRule .* - [E=INFOE_ORIG_PATH_INFO:%{ENV:ORIG_PATH_INFO},NE]
RewriteRule .* - [E=INFOE_ORIG_PATH_TRANSLATED:%{ENV:ORIG_PATH_TRANSLATED},NE]
RewriteRule .* - [E=INFOE_ORIG_SCRIPT_FILENAME:%{ENV:ORIG_SCRIPT_FILENAME},NE]
RewriteRule .* - [E=INFOE_ORIG_SCRIPT_NAME:%{ENV:ORIG_SCRIPT_NAME},NE]
RewriteRule .* - [E=INFOE_PATH:%{ENV:PATH},NE]
RewriteRule .* - [E=INFOE_PHP_SELF:%{ENV:PHP_SELF},NE]
RewriteRule .* - [E=INFOE_PHP_AUTH_DIGEST:%{ENV:PHP_AUTH_DIGEST},NE]
RewriteRule .* - [E=INFOE_THE_REQUEST:%{ENV:THE_REQUEST},NE]
RewriteRule .* - [E=INFOE_UNIQUE_ID:%{ENV:UNIQUE_ID},NE]

# NORMAL VARIABLES
RewriteRule .* - [E=INFO_HTTP_ACCEPT:%{HTTP_ACCEPT},NE]
RewriteRule .* - [E=INFO_HTTP_ACCEPT_CHARSET:%{HTTP_ACCEPT_CHARSET},NE]
RewriteRule .* - [E=INFO_HTTP_ACCEPT_ENCODING:%{HTTP_ACCEPT_ENCODING},NE]
RewriteRule .* - [E=INFO_HTTP_ACCEPT_LANGUAGE:%{HTTP_ACCEPT_LANGUAGE},NE]
RewriteRule .* - [E=INFO_HTTP_COOKIE:%{HTTP_COOKIE},NE]
RewriteRule .* - [E=INFO_HTTP_FORWARDED:%{HTTP_FORWARDED},NE]
RewriteRule .* - [E=INFO_HTTP_HOST:%{HTTP_HOST},NE]
RewriteRule .* - [E=INFO_HTTP_KEEP_ALIVE:%{HTTP_KEEP_ALIVE},NE]
RewriteRule .* - [E=INFO_HTTP_PROXY_CONNECTION:%{HTTP_PROXY_CONNECTION},NE]
RewriteRule .* - [E=INFO_HTTP_REFERER:%{HTTP_REFERER},NE]
RewriteRule .* - [E=INFO_HTTP_USER_AGENT:%{HTTP_USER_AGENT},NE]
RewriteRule .* - [E=INFO_AUTH_TYPE:%{AUTH_TYPE},NE]
RewriteRule .* - [E=INFO_CONTENT_LENGTH:%{CONTENT_LENGTH},NE]
RewriteRule .* - [E=INFO_CONTENT_TYPE:%{CONTENT_TYPE},NE]
RewriteRule .* - [E=INFO_DATE_GMT:%{DATE_GMT},NE]
RewriteRule .* - [E=INFO_DATE_LOCAL:%{DATE_LOCAL},NE]
RewriteRule .* - [E=INFO_DOCUMENT_NAME:%{DOCUMENT_NAME},NE]
RewriteRule .* - [E=INFO_DOCUMENT_PATH_INFO:%{DOCUMENT_PATH_INFO},NE]
RewriteRule .* - [E=INFO_DOCUMENT_ROOT:%{DOCUMENT_ROOT},NE]
RewriteRule .* - [E=INFO_DOCUMENT_URI:%{DOCUMENT_URI},NE]
RewriteRule .* - [E=INFO_REMOTE_ADDR:%{REMOTE_ADDR},NE]
RewriteRule .* - [E=INFO_REMOTE_HOST:%{REMOTE_HOST},NE]
RewriteRule .* - [E=INFO_REMOTE_IDENT:%{REMOTE_IDENT},NE]
RewriteRule .* - [E=INFO_REMOTE_PORT:%{REMOTE_PORT},NE]
RewriteRule .* - [E=INFO_REMOTE_USER:%{REMOTE_USER},NE]
RewriteRule .* - [E=INFO_REDIRECT_HANDLER:%{REDIRECT_HANDLER},NE]
RewriteRule .* - [E=INFO_REDIRECT_QUERY_STRING:%{REDIRECT_QUERY_STRING},NE]
RewriteRule .* - [E=INFO_REDIRECT_REMOTE_USER:%{REDIRECT_REMOTE_USER},NE]
RewriteRule .* - [E=INFO_REDIRECT_STATUS:%{REDIRECT_STATUS},NE]
RewriteRule .* - [E=INFO_REDIRECT_URL:%{REDIRECT_URL},NE]
RewriteRule .* - [E=INFO_REQUEST_METHOD:%{REQUEST_METHOD},NE]
RewriteRule .* - [E=INFO_REQUEST_URI:%{REQUEST_URI},NE]
RewriteRule .* - [E=INFO_REQUEST_FILENAME:%{REQUEST_FILENAME},NE]
RewriteRule .* - [E=INFO_REQUEST_TIME:%{REQUEST_TIME},NE]
RewriteRule .* - [E=INFO_SCRIPT_FILENAME:%{SCRIPT_FILENAME},NE]
RewriteRule .* - [E=INFO_SCRIPT_NAME:%{SCRIPT_NAME},NE]
RewriteRule .* - [E=INFO_SCRIPT_GROUP:%{SCRIPT_GROUP},NE]
RewriteRule .* - [E=INFO_SCRIPT_USER:%{SCRIPT_USER},NE]
RewriteRule .* - [E=INFO_SCRIPT_URI:%{SCRIPT_URI},NE]
RewriteRule .* - [E=INFO_SCRIPT_URL:%{SCRIPT_URL},NE]
RewriteRule .* - [E=INFO_SERVER_ADMIN:%{SERVER_ADMIN},NE]
RewriteRule .* - [E=INFO_SERVER_NAME:%{SERVER_NAME},NE]
RewriteRule .* - [E=INFO_SERVER_ADDR:%{SERVER_ADDR},NE]
RewriteRule .* - [E=INFO_SERVER_PORT:%{SERVER_PORT},NE]
RewriteRule .* - [E=INFO_SERVER_PROTOCOL:%{SERVER_PROTOCOL},NE]
RewriteRule .* - [E=INFO_SERVER_SIGNATURE:%{SERVER_SIGNATURE},NE]
RewriteRule .* - [E=INFO_SERVER_SOFTWARE:%{SERVER_SOFTWARE},NE]
RewriteRule .* - [E=INFO_GATEWAY_INTERFACE:%{GATEWAY_INTERFACE},NE]
RewriteRule .* - [E=INFO_LAST_MODIFIED:%{LAST_MODIFIED},NE]
RewriteRule .* - [E=INFO_PATH_INFO:%{PATH_INFO},NE]
RewriteRule .* - [E=INFO_PATH_TRANSLATED:%{PATH_TRANSLATED},NE]
RewriteRule .* - [E=INFO_QUERY_STRING:%{QUERY_STRING},NE]
RewriteRule .* - [E=INFO_QUERY_STRING_UNESCAPED:%{QUERY_STRING_UNESCAPED},NE]
RewriteRule .* - [E=INFO_USER_NAME:%{USER_NAME},NE]
RewriteRule .* - [E=INFO_TZ:%{TZ},NE]
RewriteRule .* - [E=INFO_API_VERSION:%{API_VERSION},NE]
RewriteRule .* - [E=INFO_HTTPS:%{HTTPS},NE]
RewriteRule .* - [E=INFO_IS_SUBREQ:%{IS_SUBREQ},NE]
RewriteRule .* - [E=INFO_ORIG_PATH_INFO:%{ORIG_PATH_INFO},NE]
RewriteRule .* - [E=INFO_ORIG_PATH_TRANSLATED:%{ORIG_PATH_TRANSLATED},NE]
RewriteRule .* - [E=INFO_ORIG_SCRIPT_FILENAME:%{ORIG_SCRIPT_FILENAME},NE]
RewriteRule .* - [E=INFO_ORIG_SCRIPT_NAME:%{ORIG_SCRIPT_NAME},NE]
RewriteRule .* - [E=INFO_PATH:%{PATH},NE]
RewriteRule .* - [E=INFO_PHP_SELF:%{PHP_SELF},NE]
RewriteRule .* - [E=INFO_PHP_AUTH_DIGEST:%{PHP_AUTH_DIGEST},NE]
RewriteRule .* - [E=INFO_THE_REQUEST:%{THE_REQUEST},NE]
RewriteRule .* - [E=INFO_TIME:%{TIME},NE]
RewriteRule .* - [E=INFO_TIME_DAY:%{TIME_DAY},NE]
RewriteRule .* - [E=INFO_TIME_HOUR:%{TIME_HOUR},NE]
RewriteRule .* - [E=INFO_TIME_MIN:%{TIME_MIN},NE]
RewriteRule .* - [E=INFO_TIME_MON:%{TIME_MON},NE]
RewriteRule .* - [E=INFO_TIME_SEC:%{TIME_SEC},NE]
RewriteRule .* - [E=INFO_TIME_WDAY:%{TIME_WDAY},NE]
RewriteRule .* - [E=INFO_TIME_YEAR:%{TIME_YEAR},NE]
RewriteRule .* - [E=INFO_UNIQUE_ID:%{UNIQUE_ID},NE]

Add Variable Values to Request

The following adds Headers to the actual request! Which means these headers are added before being parsed by php, so php sees these headers the same way it sees the normal headers send by your browser.

# VARIABLES FROM THE ENV ENVIRONMENT ADDED TO REQUEST HEADERS
RequestHeader set INFOE_PATH "%{INFOE_PATH}e"
RequestHeader set INFOE_PHP_AUTH_DIGEST "%{INFOE_PHP_AUTH_DIGEST}e"
RequestHeader set INFOE_SCRIPT_URI "%{INFOE_SCRIPT_URI}e"
RequestHeader set INFOE_SCRIPT_URL "%{INFOE_SCRIPT_URL}e"
RequestHeader set INFOE_UNIQUE_ID "%{INFOE_UNIQUE_ID}e"
RequestHeader set INFOE_API_VERSION "%{INFOE_API_VERSION}e"
RequestHeader set INFOE_AUTH_TYPE "%{INFOE_AUTH_TYPE}e"
RequestHeader set INFOE_CONTENT_LENGTH "%{INFOE_CONTENT_LENGTH}e"
RequestHeader set INFOE_CONTENT_TYPE "%{INFOE_CONTENT_TYPE}e"
RequestHeader set INFOE_DATE_GMT "%{INFOE_DATE_GMT}e"
RequestHeader set INFOE_DATE_LOCAL "%{INFOE_DATE_LOCAL}e"
RequestHeader set INFOE_DOCUMENT_NAME "%{INFOE_DOCUMENT_NAME}e"
RequestHeader set INFOE_DOCUMENT_PATH_INFO "%{INFOE_DOCUMENT_PATH_INFO}e"
RequestHeader set INFOE_DOCUMENT_ROOT "%{INFOE_DOCUMENT_ROOT}e"
RequestHeader set INFOE_DOCUMENT_URI "%{INFOE_DOCUMENT_URI}e"
RequestHeader set INFOE_GATEWAY_INTERFACE "%{INFOE_GATEWAY_INTERFACE}e"
RequestHeader set INFOE_HTTPS "%{INFOE_HTTPS}e"
RequestHeader set INFOE_HTTP_ACCEPT "%{INFOE_HTTP_ACCEPT}e"
RequestHeader set INFOE_HTTP_ACCEPT_CHARSET "%{INFOE_HTTP_ACCEPT_CHARSET}e"
RequestHeader set INFOE_HTTP_ACCEPT_ENCODING "%{INFOE_HTTP_ACCEPT_ENCODING}e"
RequestHeader set INFOE_HTTP_ACCEPT_LANGUAGE "%{INFOE_HTTP_ACCEPT_LANGUAGE}e"
RequestHeader set INFOE_HTTP_COOKIE "%{INFOE_HTTP_COOKIE}e"
RequestHeader set INFOE_HTTP_FORWARDED "%{INFOE_HTTP_FORWARDED}e"
RequestHeader set INFOE_HTTP_HOST "%{INFOE_HTTP_HOST}e"
RequestHeader set INFOE_HTTP_KEEP_ALIVE "%{INFOE_HTTP_KEEP_ALIVE}e"
RequestHeader set INFOE_HTTP_PROXY_CONNECTION "%{INFOE_HTTP_PROXY_CONNECTION}e"
RequestHeader set INFOE_HTTP_REFERER "%{INFOE_HTTP_REFERER}e"
RequestHeader set INFOE_HTTP_USER_AGENT "%{INFOE_HTTP_USER_AGENT}e"
RequestHeader set INFOE_IS_SUBREQ "%{INFOE_IS_SUBREQ}e"
RequestHeader set INFOE_LAST_MODIFIED "%{INFOE_LAST_MODIFIED}e"
RequestHeader set INFOE_ORIG_PATH_INFO "%{INFOE_ORIG_PATH_INFO}e"
RequestHeader set INFOE_ORIG_PATH_TRANSLATED "%{INFOE_ORIG_PATH_TRANSLATED}e"
RequestHeader set INFOE_ORIG_SCRIPT_FILENAME "%{INFOE_ORIG_SCRIPT_FILENAME}e"
RequestHeader set INFOE_ORIG_SCRIPT_NAME "%{INFOE_ORIG_SCRIPT_NAME}e"
RequestHeader set INFOE_PATH "%{INFOE_PATH}e"
RequestHeader set INFOE_PATH_INFO "%{INFOE_PATH_INFO}e"
RequestHeader set INFOE_PATH_TRANSLATED "%{INFOE_PATH_TRANSLATED}e"
RequestHeader set INFOE_PHP_AUTH_DIGEST "%{INFOE_PHP_AUTH_DIGEST}e"
RequestHeader set INFOE_PHP_SELF "%{INFOE_PHP_SELF}e"
RequestHeader set INFOE_QUERY_STRING "%{INFOE_QUERY_STRING}e"
RequestHeader set INFOE_QUERY_STRING_UNESCAPED "%{INFOE_QUERY_STRING_UNESCAPED}e"
RequestHeader set INFOE_REDIRECT_HANDLER "%{INFOE_REDIRECT_HANDLER}e"
RequestHeader set INFOE_REDIRECT_QUERY_STRING "%{INFOE_REDIRECT_QUERY_STRING}e"
RequestHeader set INFOE_REDIRECT_REMOTE_USER "%{INFOE_REDIRECT_REMOTE_USER}e"
RequestHeader set INFOE_REDIRECT_STATUS "%{INFOE_REDIRECT_STATUS}e"
RequestHeader set INFOE_REDIRECT_URL "%{INFOE_REDIRECT_URL}e"
RequestHeader set INFOE_REMOTE_ADDR "%{INFOE_REMOTE_ADDR}e"
RequestHeader set INFOE_REMOTE_HOST "%{INFOE_REMOTE_HOST}e"
RequestHeader set INFOE_REMOTE_IDENT "%{INFOE_REMOTE_IDENT}e"
RequestHeader set INFOE_REMOTE_PORT "%{INFOE_REMOTE_PORT}e"
RequestHeader set INFOE_REMOTE_USER "%{INFOE_REMOTE_USER}e"
RequestHeader set INFOE_REQUEST_FILENAME "%{INFOE_REQUEST_FILENAME}e"
RequestHeader set INFOE_REQUEST_METHOD "%{INFOE_REQUEST_METHOD}e"
RequestHeader set INFOE_REQUEST_TIME "%{INFOE_REQUEST_TIME}e"
RequestHeader set INFOE_REQUEST_URI "%{INFOE_REQUEST_URI}e"
RequestHeader set INFOE_SCRIPT_FILENAME "%{INFOE_SCRIPT_FILENAME}e"
RequestHeader set INFOE_SCRIPT_GROUP "%{INFOE_SCRIPT_GROUP}e"
RequestHeader set INFOE_SCRIPT_NAME "%{INFOE_SCRIPT_NAME}e"
RequestHeader set INFOE_SCRIPT_URI "%{INFOE_SCRIPT_URI}e"
RequestHeader set INFOE_SCRIPT_URL "%{INFOE_SCRIPT_URL}e"
RequestHeader set INFOE_SCRIPT_USER "%{INFOE_SCRIPT_USER}e"
RequestHeader set INFOE_SERVER_ADDR "%{INFOE_SERVER_ADDR}e"
RequestHeader set INFOE_SERVER_ADMIN "%{INFOE_SERVER_ADMIN}e"
RequestHeader set INFOE_SERVER_NAME "%{INFOE_SERVER_NAME}e"
RequestHeader set INFOE_SERVER_PORT "%{INFOE_SERVER_PORT}e"
RequestHeader set INFOE_SERVER_PROTOCOL "%{INFOE_SERVER_PROTOCOL}e"
RequestHeader set INFOE_SERVER_SIGNATURE "%{INFOE_SERVER_SIGNATURE}e"

# VARIABLES FROM THE HTTP HEADER VARIABLES ADDED TO REQUEST HEADERS
RequestHeader set INFOH_AUTHORIZATION "%{INFOH_AUTHORIZATION}e"
RequestHeader set INFOH_AUTHENTICATION_INFO "%{INFOH_AUTHENTICATION_INFO}e"
RequestHeader set INFOH_CACHE_CONTROL "%{INFOH_CACHE_CONTROL}e"
RequestHeader set INFOH_CONNECTION "%{INFOH_CONNECTION}e"
RequestHeader set INFOH_ACCEPT "%{INFOH_ACCEPT}e"
RequestHeader set INFOH_ACCEPT_CHARSET "%{INFOH_ACCEPT_CHARSET}e"
RequestHeader set INFOH_ACCEPT_ENCODING "%{INFOH_ACCEPT_ENCODING}e"
RequestHeader set INFOH_ACCEPT_LANGUAGE "%{INFOH_ACCEPT_LANGUAGE}e"
RequestHeader set INFOH_COOKIE "%{INFOH_COOKIE}e"
RequestHeader set INFOH_FORWARDED "%{INFOH_FORWARDED}e"
RequestHeader set INFOH_HOST "%{INFOH_HOST}e"
RequestHeader set INFOH_KEEP_ALIVE "%{INFOH_KEEP_ALIVE}e"
RequestHeader set INFOH_TRANSFER_ENCODING "%{INFOH_TRANSFER_ENCODING}e"
RequestHeader set INFOH_PROXY_CONNECTION "%{INFOH_PROXY_CONNECTION}e"
RequestHeader set INFOH_REFERER "%{INFOH_REFERER}e"
RequestHeader set INFOH_USER_AGENT "%{INFOH_USER_AGENT}e"

# VARIABLES FROM THE NORMAL ENVIRONMENT ADDED TO REQUEST HEADERS
RequestHeader set INFO_API_VERSION "%{INFO_API_VERSION}e"
RequestHeader set INFO_AUTH_TYPE "%{INFO_AUTH_TYPE}e"
RequestHeader set INFO_CONTENT_LENGTH "%{INFO_CONTENT_LENGTH}e"
RequestHeader set INFO_CONTENT_TYPE "%{INFO_CONTENT_TYPE}e"
RequestHeader set INFO_DATE_GMT "%{INFO_DATE_GMT}e"
RequestHeader set INFO_DATE_LOCAL "%{INFO_DATE_LOCAL}e"
RequestHeader set INFO_DOCUMENT_NAME "%{INFO_DOCUMENT_NAME}e"
RequestHeader set INFO_DOCUMENT_PATH_INFO "%{INFO_DOCUMENT_PATH_INFO}e"
RequestHeader set INFO_DOCUMENT_ROOT "%{INFO_DOCUMENT_ROOT}e"
RequestHeader set INFO_DOCUMENT_URI "%{INFO_DOCUMENT_URI}e"
RequestHeader set INFO_GATEWAY_INTERFACE "%{INFO_GATEWAY_INTERFACE}e"
RequestHeader set INFO_HTTPS "%{INFO_HTTPS}e"
RequestHeader set INFO_HTTP_ACCEPT "%{INFO_HTTP_ACCEPT}e"
RequestHeader set INFO_HTTP_ACCEPT_CHARSET "%{INFO_HTTP_ACCEPT_CHARSET}e"
RequestHeader set INFO_HTTP_ACCEPT_ENCODING "%{INFO_HTTP_ACCEPT_ENCODING}e"
RequestHeader set INFO_HTTP_ACCEPT_LANGUAGE "%{INFO_HTTP_ACCEPT_LANGUAGE}e"
RequestHeader set INFO_HTTP_COOKIE "%{INFO_HTTP_COOKIE}e"
RequestHeader set INFO_HTTP_FORWARDED "%{INFO_HTTP_FORWARDED}e"
RequestHeader set INFO_HTTP_HOST "%{INFO_HTTP_HOST}e"
RequestHeader set INFO_HTTP_KEEP_ALIVE "%{INFO_HTTP_KEEP_ALIVE}e"
RequestHeader set INFO_HTTP_PROXY_CONNECTION "%{INFO_HTTP_PROXY_CONNECTION}e"
RequestHeader set INFO_HTTP_REFERER "%{INFO_HTTP_REFERER}e"
RequestHeader set INFO_HTTP_USER_AGENT "%{INFO_HTTP_USER_AGENT}e"
RequestHeader set INFO_IS_SUBREQ "%{INFO_IS_SUBREQ}e"
RequestHeader set INFO_LAST_MODIFIED "%{INFO_LAST_MODIFIED}e"
RequestHeader set INFO_ORIG_PATH_INFO "%{INFO_ORIG_PATH_INFO}e"
RequestHeader set INFO_ORIG_PATH_TRANSLATED "%{INFO_ORIG_PATH_TRANSLATED}e"
RequestHeader set INFO_ORIG_SCRIPT_FILENAME "%{INFO_ORIG_SCRIPT_FILENAME}e"
RequestHeader set INFO_ORIG_SCRIPT_NAME "%{INFO_ORIG_SCRIPT_NAME}e"
RequestHeader set INFO_PATH "%{INFO_PATH}e"
RequestHeader set INFO_PATH_INFO "%{INFO_PATH_INFO}e"
RequestHeader set INFO_PATH_TRANSLATED "%{INFO_PATH_TRANSLATED}e"
RequestHeader set INFO_PHP_AUTH_DIGEST "%{INFO_PHP_AUTH_DIGEST}e"
RequestHeader set INFO_PHP_SELF "%{INFO_PHP_SELF}e"
RequestHeader set INFO_QUERY_STRING "%{INFO_QUERY_STRING}e"
RequestHeader set INFO_QUERY_STRING_UNESCAPED "%{INFO_QUERY_STRING_UNESCAPED}e"
RequestHeader set INFO_REDIRECT_HANDLER "%{INFO_REDIRECT_HANDLER}e"
RequestHeader set INFO_REDIRECT_QUERY_STRING "%{INFO_REDIRECT_QUERY_STRING}e"
RequestHeader set INFO_REDIRECT_REMOTE_USER "%{INFO_REDIRECT_REMOTE_USER}e"
RequestHeader set INFO_REDIRECT_STATUS "%{INFO_REDIRECT_STATUS}e"
RequestHeader set INFO_REDIRECT_URL "%{INFO_REDIRECT_URL}e"
RequestHeader set INFO_REMOTE_ADDR "%{INFO_REMOTE_ADDR}e"
RequestHeader set INFO_REMOTE_HOST "%{INFO_REMOTE_HOST}e"
RequestHeader set INFO_REMOTE_IDENT "%{INFO_REMOTE_IDENT}e"
RequestHeader set INFO_REMOTE_PORT "%{INFO_REMOTE_PORT}e"
RequestHeader set INFO_REMOTE_USER "%{INFO_REMOTE_USER}e"
RequestHeader set INFO_REQUEST_FILENAME "%{INFO_REQUEST_FILENAME}e"
RequestHeader set INFO_REQUEST_METHOD "%{INFO_REQUEST_METHOD}e"
RequestHeader set INFO_REQUEST_TIME "%{INFO_REQUEST_TIME}e"
RequestHeader set INFO_REQUEST_URI "%{INFO_REQUEST_URI}e"
RequestHeader set INFO_SCRIPT_FILENAME "%{INFO_SCRIPT_FILENAME}e"
RequestHeader set INFO_SCRIPT_GROUP "%{INFO_SCRIPT_GROUP}e"
RequestHeader set INFO_SCRIPT_NAME "%{INFO_SCRIPT_NAME}e"
RequestHeader set INFO_SCRIPT_URI "%{INFO_SCRIPT_URI}e"
RequestHeader set INFO_SCRIPT_URL "%{INFO_SCRIPT_URL}e"
RequestHeader set INFO_SCRIPT_USER "%{INFO_SCRIPT_USER}e"
RequestHeader set INFO_SERVER_ADDR "%{INFO_SERVER_ADDR}e"
RequestHeader set INFO_SERVER_ADMIN "%{INFO_SERVER_ADMIN}e"
RequestHeader set INFO_SERVER_NAME "%{INFO_SERVER_NAME}e"
RequestHeader set INFO_SERVER_PORT "%{INFO_SERVER_PORT}e"
RequestHeader set INFO_SERVER_PROTOCOL "%{INFO_SERVER_PROTOCOL}e"
RequestHeader set INFO_SERVER_SIGNATURE "%{INFO_SERVER_SIGNATURE}e"

Add Request Headers to Response Headers

Header echo ^.*

Firebug Net view of Request Headers added to Response Headers with Htaccess

Htaccess

 

 

Comments