Customizing SMF > Modifications and Packages
Add an Apache Error Handler to SMF
Deprecated:
Link to Mod
This modification adds to SMF the capability to intercept all Apache errors such as 'Error 404 - Not Found' and the like, and displays an error message to your members using your familiar forum format. It also adds error entries to SMF's error log so that you can see and investigate the errors.
There is an important matter that every hosting customer should understand. Hosting services provide default error pages if the customer does not supply their own. For example, my SMF test forum domain has the word 'dog' in its domain name, I guess because I'm fond of the critters. Without my custom error page I get a default hosting service error handler that they use for parked domains. They must have sensed the word 'dog' in my domain name because they serve up a page of suggestions for other domains that might have what the site visitor is looking for. In my case the Error 404 page has suggestions for dog food, veterinarians, dog informational sites, etc. Ask yourself this question: Are you willing to take the chance that your hosting service will send your forum members to competing services including competing forums whenever there is a site error?
Features
* Intercepts Apache errors 400-417, 500-505
* Supplies a user message indicating error type and description
* Logs the errors in SMF's error log including error URL
* Provides a seamless integration between Apache error messages and SMF
* Automatically configures your .htaccess fileNote: The modification will work only on servers with Apache installed.
Revision history
Version 1.1 (Nov. 25, 2008) Added British and British UTF-8 language strings.
Version 1.0 (Aug. 30, 2008) original release.
Nathaniel:
Very nice mod. :)
Downloaded and installed for SMF 2 Beta with no hitches. ;D
I had previously done this by using a host error page to redirect the user to a custom action within SMF, this makes it much easier.
Charles Hill:
You should be aware that this is totally incompatible with the Pretty URLs mod. I just tested it on my dev site. Had to type out the entire URL to uninstall the package.
Deprecated:
Readme.txt from the package:
Add an Apache Error Handler to SMF
Version: 1.0 Date: 2008-08-30
Compatibility: SMF 1.1.5, SMF 2.0 Beta 3.1 or later
This modification adds to SMF the capability to intercept all Apache errors such as 'Error 404 - Not Found' and the like, and displays an error message to your members using your familiar forum format. It also adds error entries to SMF's error log so that you can see and investigate the errors.
There is an important matter that every hosting customer should understand. Hosting services provide default error pages if the customer does not supply their own. For example, my SMF test forum domain has the word 'dog' in its domain name, I guess because I'm fond of the critters. Without my custom error page I get a default hosting service error handler that they use for parked domains. They must have sensed the word 'dog' in my domain name because they serve up a page of suggestions for other domains that might have what the site visitor is looking for. In my case the Error 404 page has suggestions for dog food, vetenarians, dog informational sites, etc. Ask yourself this question: Are you willing to take the chance that your hosting service will send your forum members to competing services including competing forums whenever there is a site error?Features
* Intercepts Apache errors 400-417, 500-505
* Supplies a user message indicating error type and description
* Logs the errors in SMF's error log including error URL
* Provides a seamless integration between Apache error messages and SMF
* Automatically configures your .htaccess fileNote: The modification will work only on servers with Apache installed.Screen shot
Installation
Please back up your index.php and .htaccess files before beginning the installation. Automatic deinstallation almost always succeeds but it never harms to be prepared for the worst.
The modification automatically adds directives to your .htaccess file if one is present, or creates a new .htaccess file otherwise. Any existing .htaccess file is renamed .htaccess~ for a backup after its contents have been added to the new .htaccess file. Uninstalling the modification restores your old .htaccess file if one was present, or removes the modification's .htaccess file otherwise. If you delete the backup file the modification will attempt to remove its directives from whatever .htaccess file it finds, or does nothing to the file if the modification's directives cannot be safely removed.
The .htaccess file is installed in your board directory whether it is '/' or '/forum/' or whatever your called it. If your forum is installed in e.g. '/forum/' and you would like your SMF to handle errors from the entire domain (such as including your portal) you can copy the .htaccess file to your '/' folder. Uninstallation will not remove any copied file so you will have to manually delete it if you uninstall the modification.
Note 1: If you already have a 'RewriteEngine on' directive, the modification still adds its own. Multiple instances of the directive will harm nothing, and your directive will still be there if you uninstall the modification.
Note 2: Please understand that Error 500 Internal Server Error is internally generated by Apache when it is unable to handle a request for any reason. This occurs before your error handler can be called so it is unlikely that you will ever see an Error 500 display or log entries. It is not possible to intercept Error 500 under normal circumstances so this is not a failing of the modification.Uninstallation
Use SMF's package installer to remove the modification.
Note: If desired, the included UpdateHtaccess.php file can be run stand-alone in your board directory to modify or demodify your .htaccess file. Use 'UpdateHtaccess.php' to install the .htaccess file changes. Use 'UpdateHtaccess.php?uninstall' to remove the .htaccess file changes. Or alternately, you can just manually edit or delete your .htaccess fie.Support
You may get support or submit questions and comments in the modification's support thread at the SMF site.[/hr][/hr][/hr][/hr][/hr]
Deprecated:
@LHVWB Thanks for the comments LH! I had been running a separate error handler script where I had done a quick hack, viewing HTML source on my forum index and cut 'n pasted enough HTML to make the top part look like SMF. I've been running custom error handler scripts on my non-forum websites for a couple years, and have found the error logs to be quite handy for debugging pesky little site inconsistencies. I have began running SMF forums only the last couple months but almost from the beginning when I realized I could hack my SMF and install any feature I was willing to take the time to code up, I realized that it was only a matter of time before I added custom error handlers, but it was only by finishing my earlier modification packages that I gained sufficient knowledge to tackle this mod package. I believe that my other mod packages were nice, but before now I can't really say that any of my mods couldn't be lived without. Apache Error Handler is the first mod I've written that I would put in the "can't live without" category.
@Charles, yes, of course. The Pretty Urls mod is incompatible with my Apache Error Handler mod, as are other web servers that don't run Apache. I think "totally" might be overstating the case however. I think a manual edit of the .htaccess file should allow my error handler to be called by Apache through the .htaccess and into SMF to land at the error script. It will require somebody to figure out what the Pretty Urls address of the error handler is, then an edit of the .htaccess to convert the error handler redirections to be compatible. If there is no compatible way to address the error handlers then we'll have to mod the mod and get PU to work with my mod. It doesn't sound too hard. My test SMF imploded when I installed PU and I made the decision that the URLs didn't make that much difference with search engines, so I gave up. Perhaps you or somebody with PU already working could figure it out and let me know if there's anything I should do to my mod to make the two work together. I hope it's just a matter of figuring out what PU needs to make a working path to the error handler.
Navigation
[0] Message Index
[#] Next page
Go to full version