Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess file to allow access to images folder to view pictures?

I have an images folder at the following URL.

www.mysite.com/uploads/

On a different page:

www.mysite.com/search.php/

I am trying to access the images wherein, with a correct tag link, however I get the :

Forbidden

You don't have permission to access /uploads/ on this server. 

So I went and started dabbling with a .htaccess file, and I have no idea what I am doing ,I tried looking at some documentation but with no luck, I even took an example off another question..Here is how my .htaccess file looks atm:

<FilesMatch "\.(gif|jpe?g|png)$">
Order allow,deny
Allow from all
</FilesMatch>

<Directory /uploads>
# All access controls and authentication are disabled
# in this directory
Satisfy Any
Allow from all
</Directory>

Any ideas on how I can have it allow access to that folder?

like image 685
JonE Avatar asked Apr 10 '12 10:04

JonE


3 Answers

<Directory /uploads>
   Options +Indexes
</Directory>
like image 164
Explosion Pills Avatar answered Sep 17 '22 05:09

Explosion Pills


Give permission in .htaccess as follows:

<Directory "Your directory path/uploads/">
Allow from all
</Directory>
like image 43
Dhruvisha Avatar answered Sep 17 '22 05:09

Dhruvisha


Create a .htaccess file in the images folder and add this

<IfModule mod_rewrite.c>
RewriteEngine On
# directory browsing
Options All +Indexes
</IfModule>

you can put this Options All -Indexes in the project file .htaccess ,file to deny direct access to other folders.

This does what you want

like image 36
Joshkeys Avatar answered Sep 17 '22 05:09

Joshkeys