Is it possible to let Apache automatically return a 404 page for a single URL using the Location tag?
<Location "/some/url"> # ??? </Location>
Solutions without mod_rewrite or any other modules preferred.
migrated from superuser.com Mar 1 '11 at 18:34
This question came from our site for computer enthusiasts and power users.
The only solution "without any modules", is to not have the resource exist. If the location doesn't exist, then it Apache will return a 404.
Otherwise, you will need to use mod_alias or mod_rewrite. mod_alias is the simpler and more efficient solution:
You use this inside your vhost, there is no need to put it in a Location block.
You can also use the
This and more can be read in the mod_alias documentation
Apparently you can use a
Got this information from "return 404 for specific url?" in the Apache mailing list archives.