in apache .htaccess file , we have something like this to deny access for certain files that needs to be protected
<FilesMatch "(?i)((\\.ini|\\.log|\\.txt))">
Require all denied
</FilesMatch>
but OpenLiteSpeed doesn’t read this.
so how do we deny access for files or folders ?
1. deny files with certain ext.
by simply added this code into your .htaccess
RewriteRule ^.*\\.(log|ini|txt)$ - [F,L,NC]
so any files with .log , .ini and .txt should be denied from access.
2. deny folder to be accessed.
add following code into the bottom of “vhost main configuration” area, like in screenshots
context /system {
type NULL
location /home/$VH_NAME/public_html/system
allowBrowse 0
addDefaultCharset off
}
explain: this context will NOT allow any access to http(s)://domain/system
original posted here by myself , and translated by myself ![]()