Custom Error 403 Page PHP

fart-y-goer picture fart-y-goer · Jan 2, 2012 · Viewed 49.3k times · Source

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!

Answer

JK. picture JK. · Jan 2, 2012

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.