vinpkl Posted December 3, 2008 Share Posted December 3, 2008 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 Quote Link to comment Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 Have look here http://www.webmasterworld.com/apache/3180546.htm Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 3, 2008 Author Share Posted December 3, 2008 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 Quote Link to comment Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 You have to put it in a .htaccess file, in the www root. Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 3, 2008 Author Share Posted December 3, 2008 hi dclamp how wil i create .htaccess file. it wil be created in notepad and anything else i have to write it. or simple paste those lines and save it as .htaccess and put in the root directory vineet Quote Link to comment Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 Open notepad, post those lines, edit it to apply to your needs. When you save it, make sure you type in ".htaccess" and underneath that make sure "All Files" is selected. Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 3, 2008 Author Share Posted December 3, 2008 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 Quote Link to comment Share on other sites More sharing options...
corbin Posted December 3, 2008 Share Posted December 3, 2008 Looks like either a script is messed up, or your .htaccess file is messed up. Look in the Apache error log and tell us what it says. Quote Link to comment Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 it is because you are using windows. I am pretty sure htaccess files only work on *nix Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 3, 2008 Author Share Posted December 3, 2008 hi corbin can u tell me in which folder can i find Apache error log file. i searched it gave me no result. vineet Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 3, 2008 Author Share Posted December 3, 2008 it is because you are using windows. I am pretty sure htaccess files only work on *nix hi dclamp if .htaccess dont work on windows then what is the alternate vineet Quote Link to comment Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 I am afraid i dont know of an alternative. Sorry. Quote Link to comment Share on other sites More sharing options...
vinpkl Posted December 3, 2008 Author Share Posted December 3, 2008 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 Quote Link to comment Share on other sites More sharing options...
dclamp Posted December 3, 2008 Share Posted December 3, 2008 yeah it should work on your online server. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.