Results 1 to 6 of 6

Thread: [RESOLVED] how to prevent a request from outside my website via .htaccess

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2010
    Location
    Damascus - Syria
    Posts
    145

    Resolved [RESOLVED] how to prevent a request from outside my website via .htaccess

    Hi

    I have a folder "files" which is located in the public_html folder, it has documents and files. These files are only available for registered users, I am managing download via "download.php" file which doesn't view the document url (using header function).

    but if the user did some tricks and knew the folder path with file name, he could download it even without permissions, so please help to prevent this type of request, I know this is htaccess job but don't know how to do it

    thanks

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: how to prevent a request from outside my website via .htaccess

    Move 'files' up one level.

  3. #3
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: how to prevent a request from outside my website via .htaccess

    You could also create an htaccess file in that directory, with the statement:
    Code:
    deny from all
    That would deny direct access to the files in that directory.


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Feb 2010
    Location
    Damascus - Syria
    Posts
    145

    Re: how to prevent a request from outside my website via .htaccess

    nice trick from you mr. penagate

    I am compelled to use htaccess because I need to include some videos from 'files' too (this was not mentioned above, sorry) thanks very much akhileshbc

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: how to prevent a request from outside my website via .htaccess

    Quote Originally Posted by fjober View Post
    nice trick from you mr. penagate
    It's the standard way of controlling access.

    Even if the files are outside the web root directory, you can still serve them using a script, which also takes care of authentication.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Feb 2010
    Location
    Damascus - Syria
    Posts
    145

    Re: how to prevent a request from outside my website via .htaccess

    hmmmm , double like thanks very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width