If you use an Apache Webserver, you can create a
.htaccess
file and add this code inside it:
<Files forbiddenfile.php>
Order Deny,Allow
Deny from All
</Files>
ErrorDocument 403 /ErrorPages/403.php
If you find that this is configuring the server, you can also redirect the user to the 403 page if he tries to access
forbiddenfile.php
:
<?php
header('Location: /ErrorPages/403.php');
?>
Hope this helps.