Tag Archives: public_html

How to Disable Directory Listing Using .htaccess

In this article, we’ll describe how to disable directory listing using .htaccess file.

Directory listing allows all your website visitors to get a complete listing of all the important files and folders in your site simply by typing “http://example.com/yourdir” in the browser. This is very dangerous as it gives outsiders access to the core files in your site. We can be easily prevent this by creating a custom .htaccess file in the root directory of your site.

Quick Steps

  1. Go to your cPanel account open File Manger. 
  2. Click on Settings, check the box “Show hidden files” and click Save.
  3. Open the .htaccess file and add the code “Options All –Indexes”.
  4. Click on “Save Changes” to save and close the file.

Login into your cPanel account and select File Manager from the Files section.

cPanel landing page.

Locate the .htaccess file in the File Manager. The .htaccess file should be located in your public_html directory. If you cant find it, then check if Show Hidden Files is enabled in your File Manager settings:

Creating a new .htaccess file.

If you still can’t find it, then create a new .htaccess file by clicking the File section on the top left corner of your File Manager:Select your .htaccess file and click on the Edit option from the dashboard.

Editing the .htaccess file.

Add the code “Options All –Indexes” and click Save Changes.

Editing the .htaccess file.

Conclusion

The directing listing on your site has been successfully disabled. 

How to Check Your Website’s Error Log in cPanel

If your website is not functioning or there is an error the first thing to check is the error log. cPanel comes with a built-in error log section that allows you to see the errors. In this document, we will discuss how to diagnose your website so you correct the problems.

You can check your website for errors in the cPanel interface or from the cPanel File Manager. First we will discuss how to check the errors via the cPanel interface.

Viewing Errors in the cPanel Interface

From the cPanel interface you can only see the last 300 errors your website logged. This can be very useful for finding broken links (404 errors) etc.

  1. Log in to your cPanel account and navigate to Metrics > Errors.
    The cPanel Metrics Page.

    The cPanel Metrics Page.

  2. You will see a box here and it will have the last 300 errors of the website.
The most recent error logs from your website.

The most recent error logs from your website.

Viewing Errors in the cPanel File Manager

You can see all the errors your website is generating using the cPanel File Manager tool.

  1. Login to cPanel.
  2. Click on the File Manager under Files.
  3. Move to the public_html folder, then select and open the error_log file.
    The Apache error_log in cPanel File Manager.

    The Apache error_log in cPanel File Manager.

How to Read The Errors

Basically an error log has five fields: date and time when it happened, type of error, the visitors IP, the location of where the error is occurring and the domain it is referring to. For most cases these details are sufficient to determine what is wrong and when it first started occurring.

Date and Time logged          Type      Visitor IP Address
[Fri Jan 17 21:07:47 2019]   [error]   [client 192.168.0.32] 

Location of the Error
File does not exist: /home/userna5/public_html/400.shtml, 

Domain Referrer
referer: http://example.com/?m=200911

Conclusion

Great work! Now you know how to check and review your website’s error logs in case there’s an issue.