user3234242
user3234242

Reputation:

How do make 500 Error redirect?

I am trying to make 500, 404, etc. errors redirect. If you go to http://www.yoursite.com/934834984 it should redirect to http://www.yoursite.com/404. How do I make it do that? I tried using this code:

<meta http-equiv="refresh" content="0; url=http://yoursite.com/404" />

Keep in mind that I changed the domain to yoursite.com just for this question.

Upvotes: 1

Views: 6349

Answers (3)

Leonardo Inhoqui
Leonardo Inhoqui

Reputation: 37

ErrorDocument 500 /errors/server.html not work for me

show in browser HTTP ERROR 500

Upvotes: 0

adigioia
adigioia

Reputation: 1238

You need to edit the .htacess file (with notepad) in your domain's root folder. Here are some common ones that you would add or change in the file. Obviously change the directory and locations (the part in italics). And don't include the numbers. Or you can change them from your cpanel without having to mess with the .htacess file

  1. ErrorDocument 400 /errors/badrequest.html
  2. ErrorDocument 401 /errors/authreqd.html
  3. ErrorDocument 403 /errors/forbid.html
  4. ErrorDocument 404 /errors/notfound.html
  5. ErrorDocument 500 /errors/server.html

Upvotes: 0

Panama Jack
Panama Jack

Reputation: 24478

In Apache you can use ErrorDocument. So in your .htaccess file in the root of your domain you can add this to the end of the file.

ErrorDocument 404 /404.html

The files have to exist. Here is some more info as well.

http://support.hostgator.com/articles/custom-error-pages

Upvotes: 1

Related Questions