S
S
Sergey Khlopov2022-01-08 16:08:47
Nginx
Sergey Khlopov, 2022-01-08 16:08:47

How to close access to js file at the root?

Hello, you need to block access to files that are located in the root of the site:

  • webpack.mix.js
  • package-lock.json
  • package.json
  • mix-manifest.json
  • README.md

To do this, I added the following to .htaccess:
<FilesMatch "^(webpack\.mix\.js|package-lock\.json|package\.json|mix-manifest\.json|README\.md)">
  Order allow,deny
  Deny from all
</FilesMatch>

But for some reason, I can still access the webpack.mix.js file, I noticed that it seems that it is impossible to block access to .js files through .htaccess. Maybe because nginx is still running. I think maybe then through nginx to close access to this file, please tell me how best to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kulakov, 2022-01-08
@ivankprod

In general, only the assembly, without source codes, should lie in the root of the site.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question