Return 404 error in existing directory

So, I have a directory in my root folder called / pages , in which I save all my pages, which I include through index.php

What interests me is, can I somehow return the 404 error if someone asks for it? I don't like sleeping people ...

+3
source share
4 answers

Is there any way to change the structure of my application so that these pages are outside the root document? A much better answer ...

+8
source

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

- , .htaccess :

deny from all

"401 ".

+2

Try the following rule:

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

But the flag R=404only works with Apache 2.

+2
source

gahooa gives the best solution. If you cannot place files outside the document root directory, and your host launches Apache 1.3, you can also use mod_alias :

Redirect 404 /pages
+1
source

Source: https://habr.com/ru/post/1726597/


All Articles