Browse Source

Fix for LiteSpeed and the rewrite rule [L] flag

https://forkbb.ru/topic/36/New%20install%20%3A%20Not%20seeing%20stylesheet
https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:troubleshooting:rewrite_difference_on_l_flag_between_lsws_and_apache
Visman 2 years ago
parent
commit
36c160c0f7
2 changed files with 35 additions and 11 deletions
  1. 24 8
      .dist.htaccess
  2. 11 3
      public/.dist.htaccess

+ 24 - 8
.dist.htaccess

@@ -12,18 +12,34 @@ AddDefaultCharset UTF-8
   RewriteEngine On
   #RewriteBase /
 
-  RewriteRule ^favicon\.ico$ public/favicon.ico [L]
-  RewriteRule ^robots\.txt$ public/robots.txt [L]
+  <IfModule !litespeed>
+    RewriteRule ^favicon\.ico$ public/favicon.ico [L]
+    RewriteRule ^robots\.txt$ public/robots.txt [L]
 
-  RewriteRule !^public/ index.php [L]
+    RewriteRule !^public/ index.php [L]
 
-  RewriteCond %{REQUEST_URI} \.v\.[0-9]
-  RewriteRule ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ $1.$2 [L]
+    RewriteCond %{REQUEST_URI} \.v\.[0-9]
+    RewriteRule ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ $1.$2 [L]
 
-  RewriteCond %{REQUEST_FILENAME} !-f
-  RewriteRule ^public/ index.php [L]
+    RewriteCond %{REQUEST_FILENAME} !-f
+    RewriteRule ^public/ index.php [L]
 
-  RewriteRule \.dist\. index.php [L]
+    RewriteRule \.dist\. index.php [L]
+  </IfModule>
+  <IfModule litespeed>
+    RewriteRule ^favicon\.ico$ public/favicon.ico
+    RewriteRule ^robots\.txt$ public/robots.txt
+
+    RewriteRule !^public/ index.php [L]
+
+    RewriteCond %{REQUEST_URI} \.v\.[0-9]
+    RewriteRule ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ $1.$2
+
+    RewriteCond %{REQUEST_FILENAME} !-f
+    RewriteRule ^public/ index.php
+
+    RewriteRule \.dist\. index.php
+  </IfModule>
 </IfModule>
 
 # Set Cache-Control header for caching statics

+ 11 - 3
public/.dist.htaccess

@@ -20,10 +20,18 @@ AddDefaultCharset UTF-8
   RewriteCond %{REQUEST_URI} !^/robots\.txt$
   RewriteRule . index.php [L]
 
-  RewriteRule \.dist\. index.php [L]
+  <IfModule !litespeed>
+    RewriteRule \.dist\. index.php [L]
 
-  RewriteCond %{REQUEST_URI} \.v\.[0-9]
-  RewriteRule ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ $1.$2 [L]
+    RewriteCond %{REQUEST_URI} \.v\.[0-9]
+    RewriteRule ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ $1.$2 [L]
+  </IfModule>
+  <IfModule litespeed>
+    RewriteRule \.dist\. index.php
+
+    RewriteCond %{REQUEST_URI} \.v\.[0-9]
+    RewriteRule ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ $1.$2
+  </IfModule>
 </IfModule>
 
 # Set Cache-Control header for caching statics