문제

I have an Apache web server running on Amazon EC2 and I am trying to make a custom 404 page which I did, but I want it to popup when a mistyped or wrong URL is requested. This is my .htaccess code

ErrorDocument 404 /404.html

I saved my .htaccess file in my /var/www/html directory. Am I doing something wrong? Because when I typed in a wrong url, the default Apache 404 Error keeps popping up and I don't want that to drive visitors away. Is this possible? Thanks!!!

도움이 되었습니까?

해결책

confirm that AllowOverride directive is set to All in your httpd.conf

secondly .htaccess should be kept inside the root directory of your code.

다른 팁

I figured it out. I used the same code:

ErrorDocument 404 /404.html

But instead of putting it in my .htaccess file, which never worked, I put the same code in my httpd.conf file which I found under the directory /etc/httpd/conf/httpd.conf Thanks for all your help!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top