环境变量
| 指令 | 语法 |
|---|---|
SetEnv | SetEnv name value |
SetEnvIf | SetEnvIf attribute regex [!]var[=val] |
SetEnvIfNoCase | SetEnvIfNoCase attribute regex [!]var[=val] |
BrowserMatch | BrowserMatch regex [!]var[=val] |
SetEnvIf 属性
Section titled “SetEnvIf 属性”Remote_Addr, Remote_Host, Request_URI, Request_Method, HTTP_USER_AGENT, HTTP_REFERER, HTTP_HOST,或任何 HTTP 请求头名称。
设置环境变量
Section titled “设置环境变量”SetEnv APPLICATION_ENV productionSetEnv DB_HOST localhostSetEnvIf Remote_Addr "^192\.168\." local_networkSetEnvIf Request_URI "\.pdf$" is_pdfSetEnvIfNoCase User-Agent "bot" is_botBrowserMatch "MSIE" ie_browser与 Header 指令配合使用
Section titled “与 Header 指令配合使用”SetEnvIf Request_URI "\.pdf$" is_downloadHeader set Content-Disposition "attachment" env=is_download