IIS Rewrite Input Types

2019-06-16 08:48发布

问题:

What are the input types you can use in IIS rewrite rules? The ones I mean are like as follows:

<conditions>
    <add input="{HTTP_HOST}" type=”Pattern” pattern="^www\.mysite\.com$" negate="true"> 
</conditions>
  • HTTP_HOST
  • URL
  • REQUEST_FILENAME
  • ?

回答1:

You can try the below input types. See also reference docs for the URL Rewrite module.

  • CACHE_URL
  • DOCUMENT_ROOT
  • HTTP_URL
  • HTTP_HOST
  • PATH_INFO
  • PATH_TRANSLATED
  • QUERY_STRING
  • REQUEST_FILENAME
  • REQUEST_URI
  • SCRIPT_FILENAME
  • SCRIPT_NAME
  • SCRIPT_TRANSLATED
  • UNENCODED_URL
  • URL
  • URL_PATH_INFO
  • APP_POOL_ID
  • APPL_MD_PATH
  • APPL_PHYSICAL_PATH
  • GATEWAY_INTERFACE
  • SERVER_SOFTWARE
  • SSI_EXEC_DISABLED
  • SERVER_NAME


回答2:

You can also use IIS (7 and above I believe):

Open IIS => Navigate to your website => Double-click URL Rewrite => Edit a rule => Add or Edit a condition => When you start typing '{' in the 'Condition input' field, a list of types will appear.