I created a module to custom export certain data from my site. The CSV is created in var/export. but when I try to give a link to download this file from server the link gives me 403 forbidden error. I see that the file has 777 permission. What can be the issue?
It's due to magento has security measures to disallow public to access
Deny from all
I would recommend you to save your csv file else where. May be create a new folder in root and just save the file there.
If you really want to save file in var
Remove above code from
.htaccess file. But this is very bad practice. You should
avoid this never do this.
Thanks to @fschmengler - As soon as var/cache is accssible, attackers can read sensitive configuration data. At most, add an exception for the CSV files in var/export.