Understanding Apache htaccess

Page 8 - Server Variables Part 2

Skip to navigation

Connection and Request
  • REMOTE_ADDR
    Returns the IP address of the requesting machine (i.e. the user's or a proxies).
  • REMOTE_HOST
    Returns the name of the requesting host (i.e. the user's or a proxies).
  • REMOTE_USER
    This variable is only set if a secure authentication was used to access the script, in this case it will store the username.
  • REMOTE_IDENT
    This variable is set if the server has contacted an IDENTD server on the client machine. This is a slow operation, usually turned off in most servers, and there is no way to ensure that the client machine will respond honestly to the query, if it responds at all.
  • REQUEST_METHOD
    Returns the method that initiated the request (e.g. 'GET', 'HEAD', 'POST', 'PUT').
  • SCRIPT_FILENAME
    Returns the virtual path to the requested script.
  • PATH_INFO
    Returns the server path information.
  • QUERY_STRING
    Returns the query string in the URL (i.e. the variables stored by GET).
  • AUTH_TYPE
    When running under Apache as module doing HTTP authenticated this variable is set to the authentication type.
  • Server Internals
    • DOCUMENT_ROOT
      The document root directory under which the current script is executing, as defined in the server's configuration file (httpd.conf usually).
    • SERVER_ADMIN
      The value given to the ServerAdmin directive in the web server configuration file. If the script is running on a virtual host, this will be the value defined for that virtual host. This value of this should be an email address.
    • SERVER_NAME
      This is the servers hostname, DNS alias, or IP. This is basically the same as HTTP_HOST with the exception that any characters such as < are turned into HTML entities.
    • SERVER_ADDR
      The IP address of the server that is executing the script.
    • SERVER_PORT
      Returns the server port number.
    • SERVER_PROTOCOL
      Name and revision of the information protocol via which the page was requested (e.g. HTTP/1.0).
    • SERVER_SOFTWARE
      The remote server's identification string (e.g. Apache/1.2.4).