PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Jun 19, 2019 7:14 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: .htaccess block image
PostPosted: Thu Mar 25, 2010 2:12 pm 
Offline
Forum Commoner

Joined: Wed Oct 08, 2008 5:04 pm
Posts: 87
hi guys.. on my host i have a folder named 'include' which holds all files needed for scripts and so on aswell as all my images in a subfolder 'img'
i have used a .htaccess file to block access from these folders/files using the following code
Syntax: [ Download ] [ Hide ]
deny from all

but now my images do not show within my pages.
i basically want to block people from viewing the files and images directly but can view them within a page.
meaning if someone typed into the address bar http://my-site.com/include/logo.jpg they wont be able to see it but on my homepage using <img src="/include/img/logo.jpg"> it will display
thanks :)


Top
 Profile  
 
PostPosted: Sat Jun 05, 2010 12:26 pm 
Offline
Forum Commoner

Joined: Wed Oct 08, 2008 5:04 pm
Posts: 87
hi again,
still looking for a solution on this. i have found the hotlinking to file types though.
only thing is, i get an error 500 posible bad .htaccess file message. can anyone tell me where any errors in my file may be. here is my .htaccess file
Code:
<Files .htaccess>
order allow,deny
deny from all
</Files>

ErrorDocument 404 /404.html
ErrorDocument 403 /403.html

Options -Indexes

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^ http://(www.)?my-website.domain.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|png|JPG|JPEG|GIF|PNG)$ - [F]
thanks guys :)


Top
 Profile  
 
PostPosted: Mon Jul 19, 2010 3:38 pm 
Offline
Forum Newbie

Joined: Mon Jul 19, 2010 3:31 pm
Posts: 1
One way of doing this will be to use authentication what you can do is inside the httpd.conf file add the directory tag here's a link to the apache documentation
http://httpd.apache.org/docs/2.0/howto/auth.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group