SMFHacks.com

SMF Gallery Pro => Support => Topic started by: ziissi on July 20, 2007, 09:12:29 am

Title: Direct access to picture files via browser
Post by: ziissi on July 20, 2007, 09:12:29 am
Hi! First of all, SMF Gallery Pro a great mod for our purpose. Is there anyway to deny direct access to gallery folder via browser? I now there's a index.php -file that rejects the listing of folder but in that case that someone knows direct URL to the picture. Pictures are know with 644 permission and gallery folder itself 755. Uploading the pictures is working ok.
Title: Re: Direct access to picture files via browser
Post by: SMFHacks on July 20, 2007, 08:01:18 pm
I believe with apache you can create a rewrite that will allow stopping of hot linked images if they come from another site.
Title: Re: Direct access to picture files via browser
Post by: ziissi on July 23, 2007, 12:52:17 pm
Thanks for the tip. This one worked for me:

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^.*\.mydomain.com/.*$ [NC]
RewriteRule .*\.(jpe?g|png|gif|bmp) - [NC,F,L]
Title: Re: Direct access to picture files via browser
Post by: ziissi on July 24, 2007, 12:46:51 am
btw, is it possible to move gallery directory out of /public_html directory and still get the gallery working in forum?
Title: Re: Direct access to picture files via browser
Post by: SMFHacks on July 24, 2007, 06:58:06 am
No cause it still needs to be able to find the images in order to display them.
Title: Re: Direct access to picture files via browser
Post by: ziissi on July 27, 2007, 05:33:01 am
For example some wiki systems can read their content (e.g. text files) from non public directory. To clarify things, you can place content under /home/username/data/ and the wiki itself is installed under /home/username/public_html/