Using .htaccess to stop indexing directories, disable browsing, and protecting some files. LiteSpeed Server

114 Views Asked by At

I am building a small website to allow customers download .pdf files, and I am trying to put some privacy on it using .htaccess. Important: my hosting service is Hostinger, with uses LiteSpeed servers (I am not sure if .htaccess can be used).

This is my goal:

  • Disallow search engines to index my content
  • Disallow browsing of folders
  • Protect some specific file extensions (pdf, csv)

After reading lots of posts about .htaccess on StackOverflow, finally I wrote my .htaccess like this:

Options -Indexes
<FilesMatch "\.(pdf|csv|)$">
order allow,deny
deny from all
Header set X-Robots-Tag "noindex,nofollow"
</FilesMatch>

Since it is very difficult to know if this is working (don´t want to risk my files exposed), I would like to know if it is well written or has errors or syntax errors.

Lastly: Is it correct that this .htaccess will be good for the folder where I put it and also for all the subfolders that depend below it?

I am not sure if .htaccess works on LiteSpeed servers, or how can I do the same thing.

Thank you very much.

0

There are 0 best solutions below