Differences

This shows you the differences between two versions of the page.

Link to this comparison view

litespeed_wiki:config:rewrite-rules-lsws-vs-apache [2019/03/28 17:51]
Jackson Zhang created
litespeed_wiki:config:rewrite-rules-lsws-vs-apache [2019/03/28 18:09]
Lisa Clarke Copyediting
Line 1: Line 1:
-====== Rewrite ​rules LSWS vs Apache ====== +====== Rewrite ​Rules LiteSpeed Web Server ​vsApache ====== 
-As a drop-in replacement,​ LSWS tries to match Apache rewrite rules as much as it can. Most of the time, you will find LSWS and Apache act the same way.  However, to maximize ​the speed and performance,​ there are some minor differences in rewrite rules implementation between LSWS and Apache by design. Also, we constantly review customer feedback on such rewrite ​implementation ​to balance ​the easy rewrite ​rules migration and speed+As a drop-in replacement,​ LSWS tries to match Apache rewrite rules as much as it can. Most of the time, you will find LSWS and Apache act the same way.  However, to maximize speed and performance,​ there are some minor differences in rewrite rules implementation between LSWS and Apache by design. Also, we constantly review customer feedback on such rewrite ​implementations ​to balance easy rules migration and any performance gains
  
-One of the differences is about global rewrite ​case.+===== Global Rewrite ===== 
 +One of the differences is with the processing of global rewrite ​rules.
  
-With Apache, when placing mod_rewrite files into the main httpd.conf, so long as these are wrapped in ''<​Files>'' ​or ''<​FilesMatch>'',​ ''<​Directory>''​ or ''<​DirectoryMatch>''​, then they operate as they should.+With Apache, when placing mod_rewrite files into the main ''​httpd.conf'',​ they will operate as expected, so long as they are wrapped in ''<​Files>''​''<​FilesMatch>'',​ ''<​Directory>''​ or ''<​DirectoryMatch>'' ​tags.
  
-With Litespeed, only wrapped in a ''<​Directory>'' ​worksUse of ''​DirectoryMatch'',​ ''​Files''​ and ''​FilesMatch'' ​does not work - the mod_rewrite rules do not trigger.+With Litespeed, ​//only// ''<​Directory>'' ​will trigger the rewrite rulesRules wrapped in ''​DirectoryMatch'',​ ''​Files''​ and ''​FilesMatch'' ​tags do not trigger.
  
-Tested using a simple rewrite rule:+In a cPanel environment,​ you can test this behavior with a simple rewrite rule, by switching between LSWS and Apache:
   RewriteRule ^(.*) http://​example.com [L,R=301]   RewriteRule ^(.*) http://​example.com [L,R=301]
-This can be easily tested in a cPanel environment by switching between LSWS and Apache. 
- 
-Actually, LSWS works just as designed. Not like Apache, everything is re-evaluated at run-time for each request. ​ 
-The list of server level rewrite rules are pre-computed and executed at run-time before directory matching ''​files''​ and ''​filesmatch''​ contexts are evaluated. Only ''<​Directory>''​ context can be pre-processed. 
  
 +**Why is this so?** Apache reevaluates everything at runtime for each request. LiteSpeed Web Server, however, precomputes the list of server-level rewrite rules before executing them at runtime, and only the ''<​Directory>''​ context can be preprocessed. Preprocessing happens before the ''​DirectoryMatch'',​ ''​Files''​ and ''​FilesMatch''​ contexts can be evaluated. ​
  
  • Admin
  • Last modified: 2019/03/28 18:09
  • by Lisa Clarke