I am a PHP/CodeIgniter newbie and am asking for some guidance on file structure.
Here is what's happening --> When I try to access a file (mp4 or pdf) by just entering the url into the address bar for my localhost, I am receiving a "Forbidden error" -- but no error when I access a jpeg file in the same directory.
Works:
http://localhost:8888/uploads/test-image.jpeg
Forbidden Error in same directory:
http://localhost:8888/uploads/_intro.mp4
http://localhost:8888/uploads/test.pdf
Although this does work for the mp4 and pdf file:
file:///Users/mattellis/_projects/test-projects/test/web/uploads/_intro.mp4
file:///Users/mattellis/_projects/test-projects/test/web/uploads/_intro.mp4
I need to be able access the mp4 and pdf files for the application, but not sure why the error - any help would be greatly appreciated, thanks.
.htaccess file in web folder:
#Header set X-Robots-Tag "index"
RewriteEngine on
#RewriteCond %{HTTP_HOST} !^wheelbalancetraining.com$
#RewriteRule (.*) http://wheelbalancetraining.com/$1 [R=301,L]
RewriteCond $1 !^(index\.php|assets|uploads|wp|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]
php_value max_input_time 600
php_value post_max_size 1000M
php_value upload_max_filesize 1000M
php_value max_execution_time 6000000
.htaccess file in uploads folder:
Order deny,allow
Deny from all
<Files ~ ".(jpe?g|png|gif)$">
Allow from all
</Files>
check the file permission on your files /uploads/_intro.mp4
and
/uploads/test.pdf
, they should be readable by your web server in order to be served as web files.
your try running this on command line:
$ cd /Users/mattellis/_projects/test-projects/test/web
$ chmod +r ./uploads/*
UPDATE:
if above didnt work, update the /Users/mattellis/_projects/test-projects/test/web/uploads/.htaccess
file to:
Order deny,allow
Deny from all
<Files ~ ".(jpe?g|png|gif|mp4|pdf)$">
Allow from all
</Files>