Reputation: 990
Let's say i have a public php folder like this :
root/thepublicphpfolder
and here is the private folder inside the public where i put some php scripts that user should not have direct access
root/thepublicphpfolder/privatefolder
I have successfully configure to make private folder only accessible by the application , but i can't find a way to access this folder from my script code(jquery). Do i have to make some configuration on my .htaccess file to enable jquery access my private folder or there is no way to do that ?
Upvotes: 0
Views: 102
Reputation: 1549
Since jQuery / Javascript is run in the context of the browser allowing access would effectively require allowing public access to your private folder.
What you should consider is adding an authentication layer to prevent unauthenticated access. Your PHP files would still be publicly accessible but would require authentication to perform any action. Depending on your project's requirements I would recommend taking a look at PHP sessions or some sort of OAuth flow.
Upvotes: 2