views:

73

answers:

4

Ok so i have a directory in my root folder called /pages in which i keep all my pages that i include thru index.php

What I wonder is would could i somehow return a 404 error if someone requests it? i dont like snoopy people...

+7  A: 

Is there any way you can re-structure your app so that those pages are outside the document root? Much better answer...

gahooa
Seconded. +1 but I'm out of votes for today.
Pekka
+2  A: 

Absolutely put the data outside the web root as gahooa says.

If that's totally impossible due to provider restrictions, then put a .htaccess with the following contents into the directory:

deny from all

that should block all requests to files in that directory and return a "401 forbidden".

Pekka
+2  A: 

Try this rule:

RewriteRule ^pages($|/) - [L,R=404]

But the R=404 flag does only work since Apache 2.

Gumbo
A: 

gahooa gives the best solution. If you can't place files outside of document root and your host runs Apache 1.3, you can also use mod_alias:

Redirect 404 /pages
outis