Hi guyz, I want to make it so if a user clicks a broken link, they will be redirected to another area of the site or I can customise the error page, because I don't want them to see this: Warning: page(.htm): failed to open stream: No such file or directory in /home/user/public_html/home.php on line 67 Warning: main(): Failed opening '.htm' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/home.php on line 67 Anyone know how I can do this? Thanks alott in advance. -seb
put the @ sign before your include or require statement-- that will repress the error after that, check to see if the file loaded (assign the file to a variable or see if a variable in that file now exists) .. if it did not load, echo custom error message
Wherever you do an include or require, make it look like this @include("filename.php"); Using the @ before a command will prevent the error message from being printed. You don't often want to let your users see an error message.