Home WebServer PanelcPanel How to disable directory index in cPanel

How to disable directory index in cPanel

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

In today’s article, AZDIGI will guide you to disable the index of the folder in cPanel. In some cases, your folder like wp-content or wp-admin loses the index.php file, then all your folder files when accessed directly from the browser will all appear as shown below. This will cause many disadvantages for website management, especially the ability to reduce security because the files will be visible directly.

chrome QwwHHts2ly

There are 2 ways to disable the display of the entire file directory above:

METHOD 1: CREATE AN INDEX.PHP FILE IN THE DIRECTORY

You go to the directory and create an index.php file and paste the code below into it.

For example, if I create the file index.php in the wp-content folder when accessing this folder, it will be blocked and show a 403 warning.

Don’t worry because your website can still get the image data inside this folder

<?php
// Silence is golden.

METHOD 2: DISABLE INDEX WITH THE TOOL ON CPANEL

You access the folder you want to disable => right-click on Manage Indices

Then you select No Indexing and Save it.

chrome AYwfWitLgoM

That’s already done, try to access it and you won’t see it anymore.

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign