Posted By

jessecary on 04/13/10


Tagged

php htaccess apache


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

umang_nine
tomcat23
eval
alptugan
wirenaught


Get .htaccess Variable Values


 / Published in: PHP
 

URL: http://www.askapache.com/htaccess/crazy-advanced-mod_rewrite-tutorial.html

you'll need this .htaccess file also RewriteEngine On RewriteBase / RewriteRule .* - [E=INFOAPIVERSION:%{APIVERSION},NE] RewriteRule .* - [E=INFOAUTHTYPE:%{AUTHTYPE},NE] RewriteRule .* - [E=INFOCONTENTLENGTH:%{CONTENTLENGTH},NE] RewriteRule .* - [E=INFOCONTENTTYPE:%{CONTENTTYPE},NE] RewriteRule .* - [E=INFODOCUMENTROOT:%{DOCUMENTROOT},NE] RewriteRule .* - [E=INFOGATEWAYINTERFACE:%{GATEWAYINTERFACE},NE] RewriteRule .* - [E=INFOHTTPS:%{HTTPS},NE] RewriteRule .* - [E=INFOHTTPACCEPT:%{HTTPACCEPT},NE] RewriteRule .* - [E=INFOHTTPACCEPTCHARSET:%{HTTPACCEPTCHARSET},NE] RewriteRule .* - [E=INFOHTTPACCEPTENCODING:%{HTTPACCEPTENCODING},NE] RewriteRule .* - [E=INFOHTTPACCEPTLANGUAGE:%{HTTPACCEPTLANGUAGE},NE] RewriteRule .* - [E=INFOHTTPCACHECONTROL:%{HTTPCACHECONTROL},NE] RewriteRule .* - [E=INFOHTTPCONNECTION:%{HTTPCONNECTION},NE] RewriteRule .* - [E=INFOHTTPCOOKIE:%{HTTPCOOKIE},NE] RewriteRule .* - [E=INFOHTTPFORWARDED:%{HTTPFORWARDED},NE] RewriteRule .* - [E=INFOHTTPHOST:%{HTTPHOST},NE] RewriteRule .* - [E=INFOHTTPKEEPALIVE:%{HTTPKEEPALIVE},NE] RewriteRule .* - [E=INFOHTTPMODSECURITYMESSAGE:%{HTTPMODSECURITYMESSAGE},NE] RewriteRule .* - [E=INFOHTTPPROXYCONNECTION:%{HTTPPROXYCONNECTION},NE] RewriteRule .* - [E=INFOHTTPREFERER:%{HTTPREFERER},NE] RewriteRule .* - [E=INFOHTTPUSERAGENT:%{HTTPUSERAGENT},NE] RewriteRule .* - [E=INFOISSUBREQ:%{ISSUBREQ},NE] RewriteRule .* - [E=INFOORIGPATHINFO:%{ORIGPATHINFO},NE] RewriteRule .* - [E=INFOORIGPATHTRANSLATED:%{ORIGPATHTRANSLATED},NE] RewriteRule .* - [E=INFOORIGSCRIPTFILENAME:%{ORIGSCRIPTFILENAME},NE] RewriteRule .* - [E=INFOORIGSCRIPTNAME:%{ORIGSCRIPTNAME},NE] RewriteRule .* - [E=INFOPATH:%{PATH},NE] RewriteRule .* - [E=INFOPATHINFO:%{PATHINFO},NE] RewriteRule .* - [E=INFOPHPSELF:%{PHPSELF},NE] RewriteRule .* - [E=INFOQUERYSTRING:%{QUERYSTRING},NE] RewriteRule .* - [E=INFOREDIRECTQUERYSTRING:%{REDIRECTQUERYSTRING},NE] RewriteRule .* - [E=INFOREDIRECTREMOTEUSER:%{REDIRECTREMOTEUSER},NE] RewriteRule .* - [E=INFOREDIRECTSTATUS:%{REDIRECTSTATUS},NE] RewriteRule .* - [E=INFOREDIRECTURL:%{REDIRECTURL},NE] RewriteRule .* - [E=INFOREMOTEADDR:%{REMOTEADDR},NE] RewriteRule .* - [E=INFOREMOTEHOST:%{REMOTEHOST},NE] RewriteRule .* - [E=INFOREMOTEIDENT:%{REMOTEIDENT},NE] RewriteRule .* - [E=INFOREMOTEPORT:%{REMOTEPORT},NE] RewriteRule .* - [E=INFOREMOTEUSER:%{REMOTEUSER},NE] RewriteRule .* - [E=INFOREQUESTFILENAME:%{REQUESTFILENAME},NE] RewriteRule .* - [E=INFOREQUESTMETHOD:%{REQUESTMETHOD},NE] RewriteRule .* - [E=INFOREQUESTTIME:%{REQUESTTIME},NE] RewriteRule .* - [E=INFOREQUESTURI:%{REQUESTURI},NE] RewriteRule .* - [E=INFOSCRIPTFILENAME:%{SCRIPTFILENAME},NE] RewriteRule .* - [E=INFOSCRIPTGROUP:%{SCRIPTGROUP},NE] RewriteRule .* - [E=INFOSCRIPTNAME:%{SCRIPTNAME},NE] RewriteRule .* - [E=INFOSCRIPTURI:%{SCRIPTURI},NE] RewriteRule .* - [E=INFOSCRIPTURL:%{SCRIPTURL},NE] RewriteRule .* - [E=INFOSCRIPTUSER:%{SCRIPTUSER},NE] RewriteRule .* - [E=INFOSERVERADDR:%{SERVERADDR},NE] RewriteRule .* - [E=INFOSERVERADMIN:%{SERVERADMIN},NE] RewriteRule .* - [E=INFOSERVERNAME:%{SERVERNAME},NE] RewriteRule .* - [E=INFOSERVERPORT:%{SERVERPORT},NE] RewriteRule .* - [E=INFOSERVERPROTOCOL:%{SERVERPROTOCOL},NE] RewriteRule .* - [E=INFOSERVERSIGNATURE:%{SERVERSIGNATURE},NE] RewriteRule .* - [E=INFOSERVERSOFTWARE:%{SERVERSOFTWARE},NE] RewriteRule .* - [E=INFOTHEREQUEST:%{THEREQUEST},NE] RewriteRule .* - [E=INFOTIME:%{TIME},NE] RewriteRule .* - [E=INFOTIMEDAY:%{TIMEDAY},NE] RewriteRule .* - [E=INFOTIMEHOUR:%{TIMEHOUR},NE] RewriteRule .* - [E=INFOTIMEMIN:%{TIMEMIN},NE] RewriteRule .* - [E=INFOTIMEMON:%{TIMEMON},NE] RewriteRule .* - [E=INFOTIMESEC:%{TIMESEC},NE] RewriteRule .* - [E=INFOTIMEWDAY:%{TIMEWDAY},NE] RewriteRule .* - [E=INFOTIMEYEAR:%{TIMEYEAR},NE] RewriteRule .* - [E=INFOTZ:%{TZ},NE] RewriteRule .* - [E=INFOUNIQUEID:%{UNIQUE_ID},NE]

RequestHeader set INFOAPIVERSION "%{INFOAPIVERSION}e" RequestHeader set INFOAUTHTYPE "%{INFOAUTHTYPE}e" RequestHeader set INFOCONTENTLENGTH "%{INFOCONTENTLENGTH}e" RequestHeader set INFOCONTENTTYPE "%{INFOCONTENTTYPE}e" RequestHeader set INFODOCUMENTROOT "%{INFODOCUMENTROOT}e" RequestHeader set INFOGATEWAYINTERFACE "%{INFOGATEWAYINTERFACE}e" RequestHeader set INFOHTTPS "%{INFOHTTPS}e" RequestHeader set INFOHTTPACCEPT "%{INFOHTTPACCEPT}e" RequestHeader set INFOHTTPACCEPTCHARSET "%{INFOHTTPACCEPTCHARSET}e" RequestHeader set INFOHTTPACCEPTENCODING "%{INFOHTTPACCEPTENCODING}e" RequestHeader set INFOHTTPACCEPTLANGUAGE "%{INFOHTTPACCEPTLANGUAGE}e" RequestHeader set INFOHTTPCACHECONTROL "%{INFOHTTPCACHECONTROL}e" RequestHeader set INFOHTTPCONNECTION "%{INFOHTTPCONNECTION}e" RequestHeader set INFOHTTPCOOKIE "%{INFOHTTPCOOKIE}e" RequestHeader set INFOHTTPFORWARDED "%{INFOHTTPFORWARDED}e" RequestHeader set INFOHTTPHOST "%{INFOHTTPHOST}e" RequestHeader set INFOHTTPKEEPALIVE "%{INFOHTTPKEEPALIVE}e" RequestHeader set INFOHTTPMODSECURITYMESSAGE "%{INFOHTTPMODSECURITYMESSAGE}e" RequestHeader set INFOHTTPPROXYCONNECTION "%{INFOHTTPPROXYCONNECTION}e" RequestHeader set INFOHTTPREFERER "%{INFOHTTPREFERER}e" RequestHeader set INFOHTTPUSERAGENT "%{INFOHTTPUSERAGENT}e" RequestHeader set INFOISSUBREQ "%{INFOISSUBREQ}e" RequestHeader set INFOORIGPATHINFO "%{INFOORIGPATHINFO}e" RequestHeader set INFOORIGPATHTRANSLATED "%{INFOORIGPATHTRANSLATED}e" RequestHeader set INFOORIGSCRIPTFILENAME "%{INFOORIGSCRIPTFILENAME}e" RequestHeader set INFOORIGSCRIPTNAME "%{INFOORIGSCRIPTNAME}e" RequestHeader set INFOPATH "%{INFOPATH}e" RequestHeader set INFOPATHINFO "%{INFOPATHINFO}e" RequestHeader set INFOPHPSELF "%{INFOPHPSELF}e" RequestHeader set INFOQUERYSTRING "%{INFOQUERYSTRING}e" RequestHeader set INFOREDIRECTQUERYSTRING "%{INFOREDIRECTQUERYSTRING}e" RequestHeader set INFOREDIRECTREMOTEUSER "%{INFOREDIRECTREMOTEUSER}e" RequestHeader set INFOREDIRECTSTATUS "%{INFOREDIRECTSTATUS}e" RequestHeader set INFOREDIRECTURL "%{INFOREDIRECTURL}e" RequestHeader set INFOREMOTEADDR "%{INFOREMOTEADDR}e" RequestHeader set INFOREMOTEHOST "%{INFOREMOTEHOST}e" RequestHeader set INFOREMOTEIDENT "%{INFOREMOTEIDENT}e" RequestHeader set INFOREMOTEPORT "%{INFOREMOTEPORT}e" RequestHeader set INFOREMOTEUSER "%{INFOREMOTEUSER}e" RequestHeader set INFOREQUESTFILENAME "%{INFOREQUESTFILENAME}e" RequestHeader set INFOREQUESTMETHOD "%{INFOREQUESTMETHOD}e" RequestHeader set INFOREQUESTTIME "%{INFOREQUESTTIME}e" RequestHeader set INFOREQUESTURI "%{INFOREQUESTURI}e" RequestHeader set INFOSCRIPTFILENAME "%{INFOSCRIPTFILENAME}e" RequestHeader set INFOSCRIPTGROUP "%{INFOSCRIPTGROUP}e" RequestHeader set INFOSCRIPTNAME "%{INFOSCRIPTNAME}e" RequestHeader set INFOSCRIPTURI "%{INFOSCRIPTURI}e" RequestHeader set INFOSCRIPTURL "%{INFOSCRIPTURL}e" RequestHeader set INFOSCRIPTUSER "%{INFOSCRIPTUSER}e" RequestHeader set INFOSERVERADDR "%{INFOSERVERADDR}e" RequestHeader set INFOSERVERADMIN "%{INFOSERVERADMIN}e" RequestHeader set INFOSERVERNAME "%{INFOSERVERNAME}e" RequestHeader set INFOSERVERPORT "%{INFOSERVERPORT}e" RequestHeader set INFOSERVERPROTOCOL "%{INFOSERVERPROTOCOL}e" RequestHeader set INFOSERVERSIGNATURE "%{INFOSERVERSIGNATURE}e" RequestHeader set INFOSERVERSOFTWARE "%{INFOSERVERSOFTWARE}e" RequestHeader set INFOTHEREQUEST "%{INFOTHEREQUEST}e" RequestHeader set INFOTIME "%{INFOTIME}e" RequestHeader set INFOTIMEDAY "%{INFOTIMEDAY}e" RequestHeader set INFOTIMEHOUR "%{INFOTIMEHOUR}e" RequestHeader set INFOTIMEMIN "%{INFOTIMEMIN}e" RequestHeader set INFOTIMEMON "%{INFOTIMEMON}e" RequestHeader set INFOTIMESEC "%{INFOTIMESEC}e" RequestHeader set INFOTIMEWDAY "%{INFOTIMEWDAY}e" RequestHeader set INFOTIMEYEAR "%{INFOTIMEYEAR}e" RequestHeader set INFOTZ "%{INFOTZ}e" RequestHeader set INFOUNIQUEID "%{INFOUNIQUEID}e"

  1. <?php
  2. header("Content-Type: text/plain");
  3. $INFO=$MISS=array();
  4. foreach($_SERVER as $v=>$r)
  5. {
  6. if(substr($v,0,9)=='HTTP_INFO')
  7. {
  8. if(!empty($r))$INFO[substr($v,10)]=$r;
  9. else $MISS[substr($v,10)]=$r;
  10. }
  11. }
  12.  
  13. /* thanks Mike! */
  14. ksort($INFO);
  15. ksort($MISS);
  16. ksort($_SERVER);
  17.  
  18. echo "Received These Variables:\n";
  19. print_r($INFO);
  20.  
  21. echo "Missed These Variables:\n";
  22. print_r($MISS);
  23.  
  24. echo "ALL Variables:\n";
  25. print_r($_SERVER);
  26. ?>

Report this snippet  

You need to login to post a comment.