how to download file from .htaccess protected directory

Discussion in 'Apache' started by jagjeetsingh, May 26, 2010.

  1. #1
    Hello friends
    can any body tell me how to download file from .htaccess protected directory.
    is there any way for it?
    thanks
     
    jagjeetsingh, May 26, 2010 IP
  2. chtdatweb

    chtdatweb Well-Known Member

    Messages:
    1,473
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Hi,

    Do you have the user name and password?, if so, you can simply do
    http://username:password@website.com/somefile.zip
    Code (markup):
     
    chtdatweb, May 26, 2010 IP
  3. jagjeetsingh

    jagjeetsingh Peon

    Messages:
    104
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    no i don't have.
     
    jagjeetsingh, May 26, 2010 IP
  4. chtdatweb

    chtdatweb Well-Known Member

    Messages:
    1,473
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Is this a directory you own or are you trying to take a file from someone elses protected directory?
     
    chtdatweb, May 26, 2010 IP
  5. jagjeetsingh

    jagjeetsingh Peon

    Messages:
    104
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    here is the .htaccess code by through the directory is protected

    # Protect Directory
    RewriteCond %{HTTP_REFERER} !^files [nc]
    RewriteCond %{HTTP_REFERER} !^files/ [nc]
    RewriteCond %{HTTP_REFERER} !^files/(.*) [nc]
    RewriteRule files/(.*)$ index.php?do=404 [nc]


    how i can bypas this and able to download file.
     
    jagjeetsingh, May 26, 2010 IP
  6. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The file is Protected Because the owner doesnt want public access to it. And htaccess is efficient in doing it.

    Well, If Anyone could over come Htaccess, Then why are people using it?

    Protected is Protected :D

    Thanks.
     
    extremephp, May 26, 2010 IP
  7. chtdatweb

    chtdatweb Well-Known Member

    Messages:
    1,473
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    160
    #7
    If you have access to the code protecting the directory then why dont you simply move the file to a directory that does not prevent downloads and then download the file. Or alternatively, if you have direct access to the .htaccess file then simply rename to a txt extension until you download the file? In linux it would be

     mv -f .htaccess htaccess.txt
    Code (markup):
     
    chtdatweb, May 26, 2010 IP