ISAPI_Rewrite

Apache mod_rewrite compatibility

This version of ISAPI_Rewrite was designed to maintain maximum Apache mod_rewrite compatibility. This objective was attained to at very high level, though some features could not be implemented due to their high tie-up with Apache and UNIX architecture and their implementation on IIS is senseless. For instance [H] – “force content handler” flag cannot be implemented because in IIS content handler is bounded to file extension. Or [NS] – “no sub request” flag is meaningless because there are no sub requests in IIS.
Here is a complete compatibility chart for ISAPI_Rewrite and mod_rewrite. Features or directives marked in green are fully supported, yellow features are partially supported or planned for support in next minor version, and features marked in red are unsupported.

 
  • Perl Compatible Regular Expressions (plus extended syntax)
  • Server level httpd.conf configuration
  • Virtual site .htaccess configuration files
  • Directory .htaccess configuration files
  • <VirtualHost>
  • <Directory>
  • <DirectoryMatch>
  • <Files>
  • <FilesMatch>
  • <Location>
  • <LocationMatch>
  • AccessFileName
  • RewriteEngine
  • RewriteRule
    • $N rule backreferences
    • %N RewriteCond backreferences
    • ${mapname:key|default}
    • %{VARNAME} server variables
    • '!' negation
    • [C] chain with next rule
    • [CO=name:val:domain:lifetime:path] set cookie
    • [E=var:val] set environment variable
    • [F] force forbidden response
    • [G] force gone response
    • [H=content-handler] explicit content handler (unapplicable)
    • [L] last rule flag
    • [N] apply rules again
    • [NC] ignore case
    • [NE] don't escape output
    • [NS] no internal subrequest
    • [P] proxy pass
    • [PT] pass through the next handler (always on)
    • [QSA] append query string
    • [R =code] redirect
    • [S=num] skip next n rules
    • [T=MIME-type] force explicit response MIME type
  • RewriteCond
    • [NC] ignore case
    • [OR] logical or combining
    • %{HTTP:header}
    • '!' negation
    • '<CondPattern' more than comparison
    • '>CondPattern' less then comparison
    • '=CondPattern' equal to comparison
    • '-d' directory exist
    • '-f' file exist
    • '-s' non zero file
    • '-l' symbolic link
    • '-x' file with executable permissions
    • '-F' file exist via subrequest
    • '-U' URL exist via subrequest
  • RewriteBase
  • RewriteMap
    • txt: text mapping
    • rnd: random mapping
    • int: internal functions toupper, tolower, escape, unescape
    • prg: external program
    • dbm: hash file
  • RewriteLog
  • RewriteLogLevel
  • RewriteOptions
  • RewriteLock
  • AllowOverride

Server variables compatibility:

  • HTTP_USER_AGENT
  • HTTP_REFERER
  • HTTP_COOKIE
  • HTTP_FORWARDED
  • HTTP_HOST
  • HTTP_PROXY_CONNECTION
  • HTTP_ACCEPT
  • REMOTE_ADDR
  • REMOTE_HOST
  • REMOTE_PORT
  • REMOTE_USER
  • REMOTE_IDENT
  • REQUEST_METHOD
  • SCRIPT_FILENAME
  • PATH_INFO
  • QUERY_STRING
  • AUTH_TYPE
  • DOCUMENT_ROOT
  • SERVER_ADMIN
  • SERVER_NAME
  • SERVER_ADDR
  • SERVER_PORT
  • SERVER_PROTOCOL
  • SERVER_SOFTWARE
  • TIME_YEAR
  • TIME_MON
  • TIME_DAY
  • TIME_HOUR
  • TIME_MIN
  • TIME_SEC
  • TIME_WDAY
  • TIME
  • API_VERSION (returns IIS version)
  • THE_REQUEST
  • REQUEST_URI
  • REQUEST_FILENAME
  • IS_SUBREQ
  • HTTPS
  • All special IIS variables are also supported