htaccess doesn't work in litespeed

navid picture navid · Oct 11, 2013 · Viewed 11.3k times · Source

I use the following rewrite on my site and it worked fine in shared server.

 RewriteEngine On
 <Files .*> 
     Order Deny,Allow   
     Deny From All
 </Files>
 <Files ~ "^\.ht">
     order allow,deny
     deny from all
     satisfy all
 </Files>
 <FilesMatch "^php5?\.(ini|cgi)$">
     Order Deny,Allow 
     Deny from All 
     Allow from env=REDIRECT_STATUS 
 </FilesMatch> 
 AddDefaultCharset utf-8
 Options All -Indexes
 RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|ico|txt|pdf|xml)$ [OR]
 RewriteCond %{REQUEST_FILENAME} -f [OR]
 RewriteCond %{REQUEST_FILENAME} -s [OR]
 RewriteCond %{REQUEST_FILENAME} -l [OR]
 RewriteCond %{REQUEST_FILENAME} -d
 RewriteRule ^.*$ - [NC,L]
 RewriteRule ^.*$ public_html/index.php [NC,L]   

But now it shows the following error.

404 Not Found
The resource requested could not be found on this server!
Powered By LiteSpeed Web Server
LiteSpeed Technologies is not responsible for administration and contents of this web site!

How can I fix this error?

It acts differently on LiteSpeed?

Answer

Alum picture Alum · Jul 23, 2017

Are you using Litespeed Enterprise or Openlitespeed?

OpenLitespeed cannot work with the .htaccess file, you need to configure it via web admin: Edit virtual host -> Rewrite

Litespeed Enterprise should work with the htaccess file, make sure you configure it to work with it:

Edit virtual host -> Rewrite -> Enable Rewrite: NO