Special Rewrite Rule Directives

LiteSpeed Web Server understands several special directives that can be added to rewrite rules.

If you are using LiteSpeed in an Apache environment, please make sure the following directive(s) are included in this format:

<IfModule litespeed>
LiteSpeed directives here

This ensures that the directives won't be processed by Apache if you switch to it.

Once set, this directive skips access logging. The value does not matter. For example:

RewriteRule \.gif - [E=dontlog:1] 

Closes the client's connection after finishing the current request. The value does not matter. For example:

RewriteRule .* - [E=nokeepalive:1] 

Do not use gzip compression for this request. Must be set to a non-zero value. For example:

RewriteRule \.css - [E=no-gzip:1] 

Do not set to 0. It has no effect.

Modify proxy request “Host” header value. For example:

A web site's domain name is “www.example.com.” It sends a proxy request to the backend, which is defined as a web server with name “node1.” It requires the domain name to be “www.example.com,” so the rewrite rule should be

RewriteRule ^(.*)$ http://node1/$1 [P,E=Proxy-Host:www.example.com] 

Modify LSWS page cache policy or enable cache. For example:

Rewriterule ^/special_cachable_url$ - [E=Cache-ctrl:max-ages=30] 
Rewriterule ^/non-cacheable-url$ - [E=Cache-control:no-cache] 

This flag prevents external app processes from being killed by LSWS as a runaway process while it is in the middle of processing. This is useful when executing long-running PHP applications.

RewriteRule ^script_url$ - [E=noabort:1]

Keeps the connection between server and client from timing out.

RewriteRule ^script_url$ - [E=noconntimeout:1]

This drops connection, and is useful when set up against DDoS attack. Learn more. For example:

RewriteRule .* - [E=blockbot:1]
  • Admin
  • Last modified: 2018/05/25 16:05
  • by Lisa Clarke