How to configure . htaccess to block direct access to all directories except public

Asked

Viewed 343 times

0

I have a problem with setting up . htaccess, I want the user to have access only to the public folder, so I created a . htaccess at system root blocking access to all folders and files, and one in public folder giving access.

The problem is that the . htaccess blocks jQuery from making requests outside the public folder, I want to know if there is any way to allow these requests to happen.

My website is organized like this:

site:
/public
/usuarios
/config
.htaccess

the . htacess at the root has only the code:

Allow from all

the public folder has:

Allow from all
  • And what are the requisitions that jQuery makes?

  • form validation, only because of . htaccess, returns error 403

  • If you make asynchronous requests to the folder /usuarios, then what you want is to lock the folder /config, No? What do you have in the folder /usuarios should be an API that is consulted, it should be exposed in some way, it matters if it was accessed asynchronously with jQuery or directly by the browser URL?

  • I’m gonna have files. json in the config folder and users, which I don’t want the user to be able to access directly, so the blocking, the more I need jquery to be able to request files. php in this folder. And this php does the interactions with . json

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.