Redirect all 404 pages to index.html

Status
Not open for further replies.

ecks919

New Member
Messages
4
Reaction score
0
Points
0
In the Cpanel, under the Advanced category, there is a button called error pages. I would assume that you would do it there.
 
Last edited:

zapzack

New Member
Messages
606
Reaction score
19
Points
0
or you can this in an .htaccess file

Code:
ErrorDocument 404 /index.html
 

blakec

New Member
Messages
29
Reaction score
0
Points
0
Or, in case you would like to be notified when someone receives a 404 error on your site, you could still have a 404 page for the ErrorDocument:
Code:
ErrorDocument 404 /error_pages/404.php
and then in 404.php:
Code:
<?php

mail("yourEmailAddr@example.com","404 Error On Site","Requested page: ".$_SERVER['REQUEST_URI']."\n\nIP Address: ".$_SERVER['REMOTE_ADDR']."\n\nUser agent: ".$_SERVER['HTTP_USER_AGENT']);
header("Location:http://www.example.com/index.html");
?>
I believe that's correct.

That way, when someone receives a 404 error on your site, an email will be sent to yourEmailAddr@example.com, with the subject 404 Error On Site, and the body will contain the requested page, the requester's IP address, and the requester's user agent (what OS they are using, browser, etc.).

That's what I do.

Blake
 
Status
Not open for further replies.
Top