Reputation: 6574
I have a few folders such as php_includes
templates
and a few others and I am adding a .htaccess
file for them all. So far what I have works if the user trys to directly access the file in the address bar, but I'd rather it send it to a 404 page.
IndexIgnore *
# no one gets in here!
deny from all
#error 404
ErrorDocument 404 /error/404.html
Is there something wrong with my .htaccess
All I feel like is happening is the deny from all is taking over so the 404 won't work directly. Though I've tried this with a different .htaccess
file for the main site, and the 404 isn't working in there either.
Same ErrorDocument
as the others but here is how my directory is set up
-.htaccess
--public_html
--error
--404.html
--admin
So maybe I am either getting the ErrorDocument
incorrect for my .htaccess
that or I have the path directory incorrect. Can someone please explain what the issue here is?
note I am using 000webhost
if that matters sometimes I see them doing some silly stuff, and this is just a testing server.
Upvotes: 1
Views: 384
Reputation: 5326
The deny from all directive will generate a 403 error. So just do this
ErrorDocument 403 /error/404.html
Upvotes: 0
Reputation: 786261
Since you are using deny
directive it sends error code 403
.
Declare your custom handler for 403
:
ErrorDocument 403 /error/404.html
Upvotes: 1