Rewrite
Table of Contents
Enable Rewrite⇑
Description
Specifies whether to enable LiteSpeed's URL rewrite engine. This option can be customized at the virtual host or context level, and is inherited along the directory tree until it is explicitly overridden.
Syntax
Select from radio box
Auto Load from .htaccess⇑
Description
Autoload rewrite rules contained in a directory's .htaccess file when first accessing that directory if an HttpContext for that directory using the rewritefile directive does not already exist. Once initially loaded, a graceful restart must be performed for any further changes to that .htaccess file to take effect.
Virtual Host-level setting overrides Server-level setting. Default values:
Server-level: No
VH-Level: Inherit Server-level setting
Syntax
Select from radio box
Log Level⇑
Description
Specifies the level of detail of the rewrite engine's debug output. This value ranges from 0 - 9. 0 disables logging. 9 produces the most detailed log. The server and virtual host's error log Log Level must be set to at least INFO for this option to take effect. This is useful when testing rewrite rules.
Syntax
Integer number
See Also
Name⇑
Description
Specifies a unique name for the rewrite map at the virtual host level. This name will be used by a mapping-reference in rewrite rules. When referencing this name, one of the following syntaxes should be used:
$\{MapName:LookupKey\}
$\{MapName:LookupKey|DefaultValue\}
The implementation of LiteSpeed's rewrite engine follows the specifications of Apache's rewrite engine. For more details about rewrite maps, please refer to Apache's mod_rewrite document.
Syntax
string
Location⇑
Description
Specifies the location of the rewrite map using the syntax MapType:MapSource.
LiteSpeed's rewrite engine supports three types of rewrite maps:
- Standard Plain Text
MapType: txt;
Each line of this file should contain two elements separated by blank spaces. The first element is the key and the second element is the value. Comments can be added with a leading "#" sign.
MapSource: file path to a valid plain ASCII file. - Randomized Plain Text
MapType: rnd;
File format is similar to the Standard Plain Text file, except that the second element can contain multiple choices separated by a "|" sign and chosen randomly by the rewrite engine.
MapSource: file path of a valid plain ASCII file. - Internal Function
MapType: int;
4 functions are available:
MapSource: Internal string function- toupper: converts lookup key to upper cases.
- tolower: converts lookup key to lower cases.
- escape: perform URL encoding on lookup key.
- unescape: perform URL decoding on lookup key.
The following map types available in Apache have not been implemented in LiteSpeed:
Hash File and External Rewriting Program.
Syntax
String
Rewrite Rules⇑
Description
Specifies a list of rewrite rules at the virtual host level.
Do NOT add any document root level rewrite rules here. If you have any document root level rewrite rules from .htaccess, you should instead create a static context with uri "/" and add the rewrite rules there.
A rewrite rule is comprised of one RewriteRule directive and optionally preceded by multiple RewriteCond directives.
- Each directive should take only one line.
- RewriteCond and RewriteRule follow Apache's rewrite directive syntax. Just copy and paste rewrite directives from your Apache configuration files.
- There are minor differences between LiteSpeed and Apache mod_rewrite implementation:
- %\{LA-U:variable\} and %\{LA-F:variable\} are ignored by the LiteSpeed rewrite engine
- Two new server variables are added in the LiteSpeed rewrite engine: %\{CURRENT_URI\} represents the current URI being processed by the rewrite engine and %\{SCRIPT_NAME\} has the same meaning as the corresponding CGI environment variable.
- The LiteSpeed rewrite engine will stop processing rewrite rules after encountering an [L] flag to avoid looping while Apache mod_rewrite will stop processing rewrite rules for the current iteration only. This behavior is similar to that of the [END] flag in Apache mod_rewrite.
The implementation of LiteSpeed's rewrite engine follows Apache's rewrite engine specifications. For more details about rewrite rules, please refer to Apache's mod_rewrite document and Apache's URL rewriting guide .
Syntax
string