3/12/2023 0 Comments Node automailer![]() ![]() Internet Explorer requires error pages that are at least 512 byes in size (if you use the example files you'll be fine).There you have it! Your own custom error pages that are search engine friendly, and let you know via email when you've had a visitor as well as all the information you will need to fix any problems. This way if we make a change to the mailer script, we only need to edit one file instead of two or more (if you setup additional custom error pages). Then we specify the error code to be used in the mailer script and include the mailer script so it can do its work. When search engines accidentally land on this page we want to make sure they know what kind of page it is, instead of thinking that it's a normal web page named 404.php or 403.php. What we are doing here first is setting the correct HTTP header to return 404 Not Found and 403 Forbidden, respectively. The last thing we need to do is customize the error pages we designed earlier by sending the proper headers and set the $error_code variable by inserting the following code at the beginning of each page respectively (separated by -). This version of the phpMailer class is for PHP 5/6 so if your server is running PHP 4 you will need to use the corresponding version by downloading it here. We are using the phpMailer class to do this as demonstrated by Jeffrey via the ThemeForest blog to create a nice AJAX contact form. Once you have created the file we will start by specifying our email and email settings. So with all that said, let's get on with the code shall we! The Codeįirst, we will create a file named error-mailer.php which will be used to collect information about our visitor and send the email. Being notified right away allows me to quickly take action if a website of mine is being "harvested" ( ThemeForest templates), if someone is attempting to access something restricted repeatedly or if I have a broken link somewhere.These people will only be running small sites so email is ideal. An increasing number of people are starting websites, while most of those people know almost nothing about web hosting let alone server logs.With this in mind, I want to know about 404 and 403 errors fairly quick so email is best. I am available by email almost literally all day, the fastest way to reach me is email (or twitter).I don't want to log into my server every day and dig through all that extra information.You can use your web server's logs to check for error pages and much, much more. This is the part of the tutorial in which some web guru's might argue with. The Auto-Mailer PHP and Why We Will Use Email Notification If you want to see some really great 404 designs visit: ![]() For people who want the error code, it is still available via the title. Most people don't care what 404 or 403 means, they want to know what's going on in plain English. The reason for this is to keep things as simple and user friendly as possible. Instead I chose to only use the error code in the title of the page. You'll notice it does not specify the HTTP error code in the body of the page. ![]() htaccess file if your server already has one.Īdd the following lines to your. If your server doesn't have one, you can create one using any text editor. It is sometimes hidden so make sure you are viewing all files including hidden ones. ![]() Next, connect to your server via FTP or control panel and navigate to the document root directory (usually file. In this tutorial we will configure an Apache web server (the most common). Almost all of them do, and most of them even provide a configuration area within your control panel to help you quickly create the pages. Check for custom error page supportįirst, check to make sure your hosting provider allows you to use your own error pages. This tutorial will only cover two: the "404 Not Found" and "403 Forbidden". For these reasons, it is a great idea to provide custom pages for the most common errors encountered. Default error pages are quite boring (as you can see above) and offer no purpose to visitors other than letting them know some boring error happened. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |