Contents 
  
  
    
  - Overview
- Installation & Uninstallation
- Local and remote management using IIS 7
- Context and processing order
- Apache compatibility
- Modules
- core functions
- mod_antibot
- mod_asis
- mod_auth_basic
- mod_auth_digest
- mod_authn_anon
- mod_authn_dbd
- mod_authn_default
- mod_authn_file
- mod_authz_default
- mod_authz_groupfile
- mod_authz_host
- mod_authz_user
- mod_cache
- mod_dbd
- mod_deflate
- mod_developer
- mod_dir
- mod_disk_cache
- mod_env
- mod_evasive
- mod_expires
- mod_filter
- mod_gzip
- mod_headers
- mod_hotlink
- mod_linkfreeze
- mod_log_config
- mod_logio
- mod_mem_cache
- mod_mime
- mod_proxy
- mod_replace
- mod_rewrite
- mod_seo
- mod_setenvif
- mod_so
- mod_speling
- mod_usertrack
- mod_xsendfile
 
- Articles
- Release history
- Troubleshooting
- License agreement
mod_filter
Overview
mod_filter module provides selective filter application depending on the content type.
Quick start
Compression for all php files
#put it in the root .htaccess
<Files *.php >
    FilterChain +gzip
</Files *.php >Related articles and topics
Directives
| Name | Context | Description | 
|---|---|---|
| FilterChain | S V D .h | configures the filter chain | 
| FilterDeclare | S V D .h | currently not supported | 
| FilterProtocol | S V D .h | currently not supported | 
| FilterProvider | S V D .h | registers a content filter | 
| FilterTrace | S V D .h | currently not supported | 
FilterChain
FilterChain directive builds up a filter chain out of specified filters. FilterChain may take any number of arguments, each of which may be preceded by a special character saying what should be done with the filter:
Syntax
FilterChain [+=-@!]filter-name ...| +filter-name | Add filter-name to the end of the filter chain | 
| @filter-name | Insert filter-name at the start of the filter chain | 
| -filter-name | Remove filter-name from the filter chain | 
| =filter-name | Empty the filter chain and insert filter-name | 
| ! | Empty the filter chain | 
| filter-name | Equivalent to +filter-name | 
Example
#setup complex filters
FilterChain HotLink LinkFreeze gzipExample
#setup complex filters
<Files *.php >
    FilterChain +HotLink 
    FilterChain +LinkFreeze 
    FilterChain +gzip
</Files *.php >FilterDeclare
Currently not supported.
FilterProtocol
Currently not supported.
FilterProvider
FilterProvider directive registers a provider for the filter. The provider will be called only in case the declared match matches the value of header or environment variable declared as dispatch .
Syntax
FilterProvider filter-name provider-name   [req|resp|env]=dispatch matchDescription
- provider-name is registered by loading a module that registers the name with ap_register_output_filter.
- 
    
     dispatch
    
    argument is a string with optional req=, resp= or env= prefix causing it to respectively dispatch on the request header, response header, or environment variable named. 
If no prefix is specified, by default response header is used. A special case is the word
    handler, which causesmod_filterto dispatch on the content handler.
- 
    
     match
    
    argument specifies a match that will be applied to the filter's dispatch criterion. 
The match may be a string match (exact or substring), a
    
     regex
    
    , an integer (greater, less than or equals), or unconditional. The starting characters of
    
     match
    
    string define:
    
 First character : if the first character is an exclamation mark (!), this reverses the rule, so the provider will be used only in case the match fails .
 Second character : it interprets the first character excluding any leading ! as follows:Character Description (none) exact match $ substring match / regex match (delimited by a second /) = integer equality < integer less-than <= integer less-than or equal > integer greater-than >= integer greater-than or equal * Unconditional match 
Example
#enable gzip compression for all text/* and image/* types
FilterProvider iZip  gzip Content-Type $text/               
FilterProvider iZip  gzip Content-Type /image/.*/
SetEnv iZipFilterTrace
Currently not supported.