![]() |
|
#1
|
|||
|
|||
Basic htaccess QuestionHey guys,
I have a very basic question regarding htaccess. I know that htaccess can password protect directories from being viewed, however my needs are to password protect files which arent scriptable webpages, such as a jpeg or pdf file. What im after is to prevent users from typing in the absolute url of the document eg www.mysite.com, and retrieve the file without authentication. Can htaccess provide this? Thanks, - Justin |
|||
|
#2
|
||||
|
||||
|
Are you trying to keep people from say linking to your pictures from there website. Like adding a picture to there front page that is on your server not a link to it but the picture itself?
If this is the case and people are 'hotlinking' to your image files. You can stop this from happening by placing a '.htaccess' file in the folder where your images are stored. This will only allow requests from your own pages to display the images - anyone linking to them from outside of your website, or any website you choose, will have the 'red x' instead of the image. __________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#3
|
||||
|
||||
|
What control panel does you webhost provide? You can easily password protect a directory and then put all these files in there.
|
|
#4
|
||||
|
||||
|
Of course you can do this with some PHP too.
Just save the "protected" downloadable files to a directory OUTSIDE your WWW root folder. This just ensures that no one can simply type in an address and have access to the files. However, if they login as members, you could offer them the files to be downloaded. I remember a very long time ago, I was interested in such a feature -- let me look for the thread now.... Ah! here it is: http://www.gidforums.com/t-553.html. Ignore the fact that I was discussing .tar.gz files then. It could also have been .gif or .jpeg files i.e. same idea. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| non-member function question | crq | C++ Forum | 1 | 03-Feb-2005 22:59 |
| Simple question on arrays--please help! | brookeville | C++ Forum | 16 | 18-Nov-2004 00:23 |
| Repetition structure problem and question | brookeville | C++ Forum | 17 | 29-Oct-2004 18:48 |
| Denying directory listing and htaccess question | meet_raman | Apache Web Server Forum | 11 | 01-Jul-2004 11:20 |
| question of practice | magiccreative | C++ Forum | 1 | 06-Feb-2004 08:17 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The