3

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?

3

It's due to magento has security measures to disallow public to access var folder.

see /var/.htaccess file

Order deny,allow
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.

| improve this answer | |
  • Thanks will try to save it creating a folder in root. Thanks for the quick reply :) – Harshada Chavan Mar 9 '16 at 6:09
  • Would be helpful if you accept my ans. – Adarsh Khatri Mar 9 '16 at 6:19
  • Thanks a ton.. it worked really well. I cant upvote it at this moment as I dont have enough reputation. Will you also look the following question. its bothering me for a long time now – Harshada Chavan Mar 9 '16 at 6:46
  • 2
    Not only avoid it, NEVER do it. 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 – Fabian Schmengler Mar 9 '16 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.