403 Display Page

Dear Sir,

I would like to know more about the 403 error and how to activate it.
What should I do in the .htaccess file?

Regards

You can set your own error page by adding an ErrorDocument rule to your .htaccess file like this:

ErrorDocument 403 <url of the error page>

Where <url of the error page> can be one of two things:

  • A path to a file like /myerrors/custom403.php which means the file at htdocs/myerrors/custom403.php will be called.
  • A web page URL like http://example.com/myerrors/custom403.php which will redirect visitors to that URL.

Hello again,

I tried to do that but when I am trying to access the following link www.aminantabli.com/images, the list of files is shown. Notice that the folder does not have an index file. Moreover, I am pointing this domain to the cloudflare ns but I am still able to use the cpanel of infinityfree.
Is their a way to make something inside the cloudflare about the 403 error?

Regards

Oh, I understand now. It’s not about customizing a 403 error page, you want to disable directory listing so a 403 page is shown instead.

To do that, you need to use this .htaccess rule:

Options -Indexes