Nội dung
In this article, AZDIGI will show you how to display files in the website directory so that your visitors can view or download these files directly.
I. Overview
By default, the system will not display the files of any folder of the website. And when you try to access it, you will get a blank page or with a 403 (Access is not allowed) message as shown below:
So how do we able to display all the files?
Please refer to the following steps.
II. Enable displaying files in the website folder
I’m using DirectAdmin Apache, so in this tutorial, I will work on the DirectAdmin interface. In case you use other control panels such as cPanel, aaPanel, FASTPANEL, CyberPanel, it is almost the same.
If you are using an Openlitespeed webserver, please refer to the following tutorial for Openlitespeed to read and understand the .htaccess file.
Nginx doesn’t support this file.
To enable the display of files in the website directory, we perform the following 3 steps.
Step 1: Access your DirectAdmin
To access DirectAdmin, you need to access the link http://IP:2222 on your browser.
Below is my DirectAdmin interface:
After entering the DirectAdmin interface, we go to step 2 to enable the display of files in the website directory with the .htaccess file.
Step 2: Enable displaying files in the website folder with htaccess
Go toSystem Info & Files > File Manager.
Here, depending on the folder where you want to share files, you move there. I have a folder on my website called tai-xuong and I will go to that folder.
Note: In this directory, you absolutely must not have an index file like index.php, index.html… available. Because if so, please rename this file to a different name.
Here I don’t have any index files. And I will need to create a new file named .htaccess, the reason this file has a dot in front is that this is a hidden file.
How to create a file is as follows.
And name the .htaccess file.
After you have created a file named .htaccess, you need to right-click on this file and select Edit as shown below.
On the content editing page, you can add the following content and save it.
Options +Indexes
Let’s review the results before and after.
So we have succeeded in displaying the file in the website directory.
III. Summary
So AZDIGI has completed the steps to display files in the website directory. However, you should only show folders with unimportant data.
Hope this article will be of help to you. Wishing you success!
See more useful articles about DirectAdmin at the following link:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com