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
[SOLVED] Return Error 404 when a specified file is requested
Moderator: General Moderators
-
tomfra
- Forum Contributor
- Posts: 126
- Joined: Wed Jun 23, 2004 12:56 pm
- Location: Prague, Czech Republic
[SOLVED] Return Error 404 when a specified file is requested
Last edited by tomfra on Sat Jul 03, 2004 8:04 am, edited 2 times in total.
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
you can do this without .htaccess with something similar to the following example:
then just define IN_TOMFRA in a commonly used include or something..
Code: Select all
<?php
if(!defined('IN_TOMFRA')) { header("HTTP/1.0 404 Not Found"); exit; }
?>