Domanda

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!!!

È stato utile?

Soluzione

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

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

Altri suggerimenti

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!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top