Skip to content
Advertisement

Custom Error 403 Page PHP

I created a .htaccess inside a directory in which I don’t want the files to be directly accessed. It works and fires the default 403 page (Access forbidden!) of the Apache server. How can I create a custom 403 page? Thanks!

Advertisement

Answer

In your .htaccess file you can specify what document you want as your default 403 error document.

ErrorDocument 403 /dir/file.html

Here the directory is relative to the document root.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement