I read this artcile on file upload security, but now it seems that a valid pdf I uploaded is being given access forbidden after implenting this htaccess on top of the other security methods mentioned:
deny from all
<Files ~ "^\w+\.(gif|jpe?g|png|pdf|doc|docx|txt|rtf|ppt|pptx|xls|mp4|mov|mp3|mpg|mpeg)$">
order deny,allow
allow from all
</Files>
The file name looks like this:
Company-apv-A4-Solarpanels_ABC-RH.pdf
Which should be fine because the htaccess is meant to prevent the doubled extension attack if I understand correctly. Hope someone can help!
Why not:
Also note that I dropped the mandatory leading ^ as you surely want to allow access to these extensions in subdirs and
[-\w]+as-is not in\w.I would just start my regexp
\.(gif… as you really only need to check the extension for what you want. Up to you.