GIDForums  

Go Back   GIDForums > Web Hosting Forums > Apache Web Server Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 09-Jun-2005, 17:19
justinhn justinhn is offline
New Member
 
Join Date: May 2005
Posts: 3
justinhn is on a distinguished road
Smile

Basic htaccess Question


Hey 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  
Old 10-Jun-2005, 19:12
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,060
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
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  
Old 12-Jun-2005, 13:52
Div's Avatar
Div Div is offline
Moderator
 
Join Date: May 2002
Posts: 996
Div has a spectacular aura aboutDiv has a spectacular aura about
What control panel does you webhost provide? You can easily password protect a directory and then put all these files in there.
__________________
Web Hosting Tips | Career Advice
  #4  
Old 13-Jun-2005, 08:20
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
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.
 
 

Recent GIDBlogMeeting the local Iraqis by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
non-member function question crq C++ Forum 1 03-Feb-2005 21:59
Simple question on arrays--please help! brookeville C++ Forum 16 17-Nov-2004 23:23
Repetition structure problem and question brookeville C++ Forum 17 29-Oct-2004 17:48
Denying directory listing and htaccess question meet_raman Apache Web Server Forum 11 01-Jul-2004 10:20
question of practice magiccreative C++ Forum 1 06-Feb-2004 07:17

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:35.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.