Reputation: 21
I'm a new user of OpenLitespeed web server. Previously I used Apache for my web server. Now, I'm getting confused about .htaccess for security purpose in OpenLitespeed.
Below my .htaccess rule works great in Apache
IndexIgnore *.css *.js *.png *.jpg
Options -Indexes
ErrorDocument 400 index.php
ErrorDocument 403 index.php
ErrorDocument 404 index.php
ErrorDocument 500 index.php
<Files ~ "\.optl$">
Order allow,deny
Deny from all
</Files>
How can I use this rule in OpenLiteSpeed Web Server? Thank you
Upvotes: 2
Views: 5806
Reputation: 43
In openlitespeed you must point your .htaccess file in virtual host. From openlitespeed admin Klik Virtualhost -> Select your virtualhost, in tab Rewrite check to 'Yes' for Enable Rewrite, and rewrite rule insert your path of file .htaccess for example /usr/local/lsws/yourweb/.htaccess
And restart your openlitespeed server
/usr/local/lsws/bin/lswsctrl restart
You can use scripts auto install with support multi vhost from https://github.com/tujuhion/openlitespeed-centos-autoinstall
Upvotes: 0
Reputation: 839
For OpenLitespeed web server.
You can set ErrorDocument through Virtual Host -> General -> Customized Error Pages
Error Code support all your needed. e.g. 300 ~ 505 which include 400,403,404,500.
You can set Index file though Virtual Host -> General -> Index Files
Both above rules probably not supported from "another way", that's why you need to setup from web admin. "another way" only support rewrite rules.
Upvotes: 0
Reputation: 14487
I am not sure this is the correct answer, but I put it here in case you need it:
OpenLitespeed supports .htaccess in another way. You can copy the rewrite rules from the .htaccess and paste into OpenLiteSpeed admin console:
https://serverfault.com/questions/538249/does-openlitespeed-support-apache-rewrites
Update: Yes I just tested it as I met this issue now. It did work.
Upvotes: 1