Seems it is a question about .htaccess
, not sure what should I use.
How can I make files inside /data/
folder available to read
and write
only for scripts?
Users should not have access to them from browser window.
Seems it is a question about .htaccess
, not sure what should I use.
How can I make files inside /data/
folder available to read
and write
only for scripts?
Users should not have access to them from browser window.
You can change the ownership of the directory to the www
or apache
user, depending on what user your web-server is running as.
Then make sure that the permissions of the directory are set to 644 so that only the owner can write. If you want nobody else to be able to read, just make it 600.
Simplest way to block access to non-scripts: move it outside the web server's document root. If your PHP files are served from /var/www/htdocs
, put your data files in /var/www/data
.
If that's not possible, the .htaccess
solution looks like:
# don't let anyone access these files directly
Order allow,deny
Deny from all