Jump to content

restrict access to images folder


vinpkl

Recommended Posts

hi all

 

i have two folders

1) images folder

2) document folder

 

at present any body can write

1) domain.com/images/logo.gif

2) domain.com/document/resume.doc

 

and access the file from the addres bar.

 

i want to restrict this access to all visitors.

i have searched on this topic and found it may be posible with .htaccess file but i dont know how to make .htaccess file and what to write in it. If there is any other way to do then also tell me.

 

vineet

Link to comment
Share on other sites

hi dclamp

 

i read the link that u gave me. i would like to ask that they have written these code lines

RewriteEngine on 
RewriteRule ^(.*)$ - [F] 

 

and

RewriteCond %{HTTP_REFERER}!^$ 
RewriteCond %{HTTP_REFERER}!^http://(www\.)?domain.com(/)?.*$ [NC] 
RewriteRule .*\.(gif¦jpg¦png)$ - [F] 

 

can u tell me where they are inserting these lines. they are not talking about where to put these lines, in php or where so that i can insert them and test them.

 

vineet

Link to comment
Share on other sites

hi dclamp

 

i m using xampp. i have my project at

 

http://localhost/vineet/

 

i created .htaccess file and pasted this file in vineet folder. after this

when i accessed in the server

 

http://localhost/vineet/

 

i got this error

Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. 

If you think this is a server error, please contact the webmaster. 

Error 500
localhost
12/03/08 10:33:54
Apache/2.2.8 (Win32) DAV/2 mod_ssl/2.2.8 OpenSSL/0.9.8g mod_autoindex_color PHP/5.2.5 

 

Its blocking the whole website to even display.

 

vineet

 

 

Link to comment
Share on other sites

hi dclamp

 

if this solution doesnt work on windows. Then wil it work if i put this file on online server.

 

because online server wil always be linux for php hosting. I cannot check it at present but if its works then i can apply it in future when i take linux hosting.

 

vineet

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.