How can we avoid direct access to files under the server?

Source: Internet
Author: User
Tags godaddy server
Just as if I have a folder with a cp.rar and a domain name www.fox.com under the Directory of the server, then how can I enter a folder in the address bar of the browser to avoid direct access to files on the server?
For example, if I have a folder named DLand a cp.rar under the Directory of the server and my domain name is www.fox.com, enter "Taobao" in the address bar of the browser. What should I do.
In fact, I want to achieve this effect. after the customer pays, I can ask him to download the file. it cannot be said that he knows that the file is downloaded directly from the path of my server.

------ Solution --------------------
. Htaccess
------ Solution --------------------
Put the file outside the root directory of the document, and use php to retrieve and send it back.
------ Solution --------------------
Discussion

. Htaccess

------ Solution --------------------
Discussion

. Htaccess

------ Solution --------------------
You can also use the define page to reference the defined define file to determine whether the define exists.
------ Solution --------------------
Discussion

You can also use the define page to reference the defined define file to determine whether the define exists.

------ Solution --------------------
Discussion

Reference:

You can also use the define page to reference the defined define file to determine whether the define exists.


Anti-hop walls, but some files are static files that are directly downloaded, and cannot be used here.

------ Solution --------------------
Although I don't need godaddy, I'm 99.9999% sure they support it.

If you don't ask Niu again, he seems to be using a godaddy server.


Discussion

Reference:

. Htaccess

The godaddy I use does not seem to allow users to change. htaccess.

------ Solution --------------------
If all requests are rejected,
Simple deny from all

If you need to set complex permissions based on ip/user and other permissions, you need to go through the manual...


Discussion

Reference:

. Htaccess

How can this problem be achieved?

------ Solution --------------------
If the file is not very large, you can use php to determine and directly output the file ..
------ 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.