Sunday, November 27, 2016

web server - How do I configure the default virtual host return a 404 header in apache?



I know that similar questions have been asked, but the available answers are not very clear, so please bear with me.



After setting up a few s in apache, I'd like to configure the _default_ ServerName so that it returns the 404 message. I.e., unless some explicitly available domain is specified in the Host http header, return 404. (Ideally something more direct than pointing to a now-nonexistent directory.)




Any help would be greatly appreciated.


Answer



Did you try:




Redirect 404 /
ErrorDocument 404 "Page Not Found"


in the default VirtualHost?



No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...