简体   繁体   中英

.htaccess block user to access some directory but using the file in that directory via jquery ajax

I have a directory called "db_interface". In this directory there are all the files .php that allow me to retrieve data from my database. If someone try to search one of this file in the searchbar of chrome or firefox, he can access to all of this content. I've tried to put in this directory an .htaccess file with

deny from all

and it worked. But if I want to use this files to provide the login or to do some ajax call, I have the same 403 error handled by the .htaccess.

In a nutshell I want be able to use this file only if is another page to call them and not if is an user using chrome or firefox searchbar.

Thanks to all

Update your .htaccess file in db_interface with following code. It will prevent all the files from the direct access, but you can include all those prevented files in another independent file, and make d :

order deny,allow
deny from all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM