How do I keep people from accessing files directly under the server

Source: Internet
Author: User
How do I keep people from accessing files directly on the server?
For example, I have a folder under the server directory Dl,dl under a cp.rar, my domain name is www.fox.com, that in the browser address bar input http://www.fox.com/dl/ Cp.rar is not able to directly download files on the server, I want others to download the file should be how to do, I do not have permission to modify the contents of the Apache file on the server. What should I do then?
In fact, I want to achieve this effect, the customer after payment I can let him download, can not say that he knows the file in my server path directly to download.

------Solution--------------------
. htaccess
------Solution--------------------
Put the file outside the document root directory and use PHP to get it back.
------Solution--------------------
discuss

. htaccess

------Solution--------------------
discuss

. htaccess

------Solution--------------------
You can also use the Define page to refer to the definition of the define file to determine whether the define exists.
------Solution--------------------
discuss

You can also use the Define page to refer to the definition of the define file to determine whether the define exists.

------Solution--------------------
discuss

Reference:

You can also use the Define page to refer to the definition of the define file to determine whether the define exists.


Anti-jumps over Ah, but others files are directly downloaded static files, here is not used.

------Solution--------------------
Although I don't need GoDaddy, I'm 99.9999% sure they support

Don't you ask Niu, he seems to be useful GoDaddy's server.


discuss

Reference:

. htaccess

I use the GoDaddy, it seems that can not let users change. htaccess

------Solution--------------------
If you just deny access,
Simple deny from all on the line

If the need to be complex to set up according to Ip/user and other different permissions, the one to turn the manual ...


discuss

Reference:

. htaccess

How to achieve it?

------Solution--------------------
If the file is not particularly large, you can use PHP to determine the direct output.
------Solution--------------------
. htaccess+1
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.