Page 1 of 1

[SOLVED] Return Error 404 when a specified file is requested

Posted: Fri Jul 02, 2004 9:30 pm
by tomfra
In .htaccess, how I set that a given file which *does* exist should return a 404 Page Not Found Error when accessed through web browser but does not return any 404 error when accessed directly by a file in the same folder or on the same domain?

Thanks!

Tomas

Posted: Fri Jul 02, 2004 9:42 pm
by feyd
you can do this without .htaccess with something similar to the following example:

Code: Select all

<?php

if(!defined('IN_TOMFRA')) { header("HTTP/1.0 404 Not Found"); exit; }

?>
then just define IN_TOMFRA in a commonly used include or something..

Posted: Sat Jul 03, 2004 8:04 am
by tomfra
Thanks, it works!

Tomas