In order to protect some JSON files, I am trying to limit the access to one unique JavaScript file which loads some array with those JSON files.
I have been checking out some .htaccess examples around, using codes like the one below.
I have a folder called data
with the JSON file: localhost/myWebsiteFolder/data/fileToProtect.json
So I created a .htaccess file in that folder whose address is localhost/myWebsiteFolder/data/.htaccess
And its content is:
<FilesMatch "\.(htaccess|json|php)$">
Order Allow,Deny
Deny from all
Allow from "localhost/myWebsiteFolder/*.*"
</FilesMatch>
The file becomes restricted but I can’t access it from another file…
I’ve trying with another example and I get similar results.