Differences
This shows you the differences between two versions of the page.
litespeed_wiki:config:lsws5.3-rewrite-improvement [2018/11/06 15:29] Jackson Zhang created |
litespeed_wiki:config:lsws5.3-rewrite-improvement [2018/11/06 16:30] (current) Lisa Clarke Rewriting |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== LSWS 5.3 Improves rewrite Engine to match Apache behavior ====== | + | ====== Changes to Rewrite Engine in LSWS v5.3+ ====== |
- | There are some improvements on LSWS 5.3 rewrite Engine to match Apache behavior. Hence some rewrite rules may work on LSWS 5.2.x but it may break after upgrading to 5.3.x. Don't worry, the purpose of the new changes is just to align the rewrite rules to match Apache behavior and generally some minor changes should fix the issue. | + | In previous versions of LiteSpeed Web Server (v5.2.x and lower), certain rewrite rules were processed differently than they were with Apache. LSWS v5.3 has addressed these inconsistencies, and now the LiteSpeed rewrite engine matches Apache behavior. |
- | For example, LSWS 5.3 ignores "RewriteBase /" in a subdirectory. If someone uses it as a feature, it will break on LSWS 5.3 while it may work with 5.2.x and below version. The fix is to rewrite to absolute URL, instead of relative URL, or fix the rewrite base. | + | This is good news, and means better Apache compatibility. However, if you have previously relied on these differences in your own rewrite rules, you may have rewrite rules that are now broken after upgrading to 5.3. Some minor changes should fix the issue. |
- | in /home/user1/public_html/sub1/.htaccess sub folder "sub1" of domain's the document root: | + | ===== RewriteBase ===== |
+ | |||
+ | LSWS 5.3 now ignores ''RewriteBase /'' in a subdirectory (like Apache does). If you've previously used it as a feature with v5.2.x and lower, it will break when you upgrade to 5.3. | ||
+ | |||
+ | To fix the problem, rewrite to the absolute URL instead of a relative URL, or fix the rewrite base. | ||
+ | |||
+ | In ''/home/user1/public_html/sub1/.htaccess'', which is the ''sub1'' subfolder of the domain's document root: | ||
<IfModule mod_rewrite.c> | <IfModule mod_rewrite.c> | ||
Line 12: | Line 18: | ||
</IfModule> | </IfModule> | ||
- | For rewrite rule, you should not use ''RewriteBase /'' at subfolder. The fix is easy: just update the last rewrite rule to | + | Simply replace: |
+ | RewriteBase / | ||
+ | RewriteRule ^(.*) index.php [L] | ||
+ | With: | ||
RewriteRule ^(.*) /index.php [L] | RewriteRule ^(.*) /index.php [L] | ||
- | The new rules are actually correct rules, which should work on both LSWS 5.3.x, LSWS 5.2.x and Apache. | + | This will work on both LSWS v5.3.x and LSWS v5.2.x, and on Apache. |
- | + |