Add an Apache Error Handler to SMF

Started by Deprecated, September 02, 2008, 04:15:47 AM

Previous topic - Next topic

Bancherd

This is a very good mod(along with The Rules :D )....it helped me find  errors while using my test site; which would be difficult to find otherwise.

There is a warning though.....it does not like my local test box(xampp+windows)....always bombed on mod's installation.  Is there a simple work around?

Deprecated

All my mod packages are very good. ;) ;) ;)

I can't think of why it wouldn't work on Xampp (which does have Apache) but I have no experience with Xampp and no test setup for that. All my testing is done on shared hosting test sites using Apache/PHP/Unix etc. provided by the hosting service, a pretty standard setup. But it isn't Xampp.

I have no way of testing it so there is no way that I can find out why it doesn't work on Xampp.


Yes, it is a good package for spotting errors. That's the main advantage of installing this mod package, although the error pages the user sees is also a benefit.

Have fun! :)

shadow82x

Very interesting mod. :D Thanks for sharing.
Colin B
Former Spammer, Customize, & Support Team Member

blondeamon

It would be super great if you could make it work for lightptd servers as well.

Is it possible mate?
Always looking for the best

www.kamenos.gr  Greek Gaming Community

Deprecated

Well it might be possible for you to just configure your LightTpd options to partially use the mod even now. I was surfing their site and noted an option "server.error-handler-404" which can be set to point to an error document. If you point that to "/index.php?action=error;code=404" I expect that SMF would log the error and send the error page.

If there is a corresponding setting for 403 Forbidden then you would already have probably 98% of likely errors already covered because most errors result from file not found or access forbidden.

You should seek advice from some LightTpd experts and see if these two and possibly any other errors could be covered. It would be a manual configuration but you only need to set it up once.

Plesase let me know if you find anything. :)

bjraines

I am very curious about this mod

my problem is that if I have links that no longer exists, the forum defualts to the index page and show NO 404 page

bjraines

I tried using this mod yesterday, and foolishly on my part i didn't realize it might not work with pretty urls mod

is there a way to get this to work as I could really use the 404 pages

Deprecated

The Apache Error Handler and Pretty URLs mods are mutually incompatible. Sorry.

bjraines

I see,

Although I have long left it, I used to be big into Joomla

most of the SEF (pretty) URL extensiosn and 404 are tied together in some way.

thanks for replying!

Deprecated

I'm sorry that my reply couldn't be more useful.

bjraines

hey no problem...i just wish it could work for me

maybe i can find a fix somehow because I really need a good 404 page

L'AltroWeb

#51
Quote from: Deprecated on October 22, 2008, 08:44:27 AM
The Apache Error Handler and Pretty URLs mods are mutually incompatible. Sorry.
I've installed with pretty urls and after some little edit on .htaccess now all seems to works fine :)
http://darkwolf.altervista.org/smf2/index.php
Simply put this code # beginning of directives for Apache Error Handling modification
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)  /smf2/index.php?action=error;code=404
ErrorDocument 400 /smf2/index.php?action=error;code=400
ErrorDocument 401 /smf2/index.php?action=error;code=401
ErrorDocument 402 /smf2/index.php?action=error;code=402
ErrorDocument 403 /smf2/index.php?action=error;code=403
ErrorDocument 404 /smf2/index.php?action=error;code=404
ErrorDocument 405 /smf2/index.php?action=error;code=405
ErrorDocument 406 /smf2/index.php?action=error;code=406
ErrorDocument 407 /smf2/index.php?action=error;code=407
ErrorDocument 408 /smf2/index.php?action=error;code=408
ErrorDocument 409 /smf2/index.php?action=error;code=409
ErrorDocument 410 /smf2/index.php?action=error;code=410
ErrorDocument 411 /smf2/index.php?action=error;code=411
ErrorDocument 412 /smf2/index.php?action=error;code=412
ErrorDocument 413 /smf2/index.php?action=error;code=413
ErrorDocument 414 /smf2/index.php?action=error;code=414
ErrorDocument 415 /smf2/index.php?action=error;code=415
ErrorDocument 416 /smf2/index.php?action=error;code=416
ErrorDocument 417 /smf2/index.php?action=error;code=417
ErrorDocument 500 /smf2/index.php?action=error;code=500
ErrorDocument 501 /smf2/index.php?action=error;code=501
ErrorDocument 502 /smf2/index.php?action=error;code=502
ErrorDocument 503 /smf2/index.php?action=error;code=503
ErrorDocument 504 /smf2/index.php?action=error;code=504
ErrorDocument 505 /smf2/index.php?action=error;code=505
# end of directives for Apache Error Handling modification
at the end of htaccess generated by pretty url.

Deprecated

I will appreciate more reports on whether Dark Wolf's suggestion works, i.e. to make Pretty URLs and my mod play together by putting my .htaccess data at the end of the file. I was worried that unknown .htaccess commands could prevent my mod from working unless I put my codes at the top. If the suggested fix works then we can add an application note to help Pretty URLs users integrate the Apache Error Handler.

L'AltroWeb

:)
If is util, this is my entire htaccess
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: November 22, 2008, 18:21

RewriteEngine on
#change /smf2 with your forum directory eg: /forum
RewriteBase /smf2

# Rules for: profiles
RewriteRule ^profile/([^/]+)/?$ ./index.php?pretty;action=profile;user=$1 [L,QSA]

# Rules for: actions
RewriteRule ^(activate|admin|announce|attachapprove|buddy|calendar|clock|collapse)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(contact|coppa|credits|deletemsg|display|dlattach|editpoll|editpoll2|emailuser)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(findmember|forum|groups|guestbook|help|downloads|helpadmin|im|jseditor)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(jsmodify|jsoption|lock|lockvoting|login|login2|logout|markasread)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(mascot|mergetopics|mgallery|mlist|moderate|modifycat|modifykarma|movetopic|movetopic2)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(notify|notifyboard|openidreturn|pm|post|post2|printpage|profile)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(quotefast|quickmod|quickmod2|recent|register|register2|reminder|removepoll)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(removetopic2|reporttm|requestmembers|restoretopic|search|search2|sendtopic|smstats)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(suggest|spellcheck|splittopics|stats|sticky|theme|trackip|about:mozilla)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(about:unknown|unread|unreadreplies|verificationcode|viewprofile|vote|viewquery|viewsmfile)/?$ ./index.php?pretty;action=$1 [L,QSA]
RewriteRule ^(who|\.xml|xmlhttp)/?$ ./index.php?pretty;action=$1 [L,QSA]

# Rules for: boards
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([0-9]*)/?$ ./index.php?pretty;board=$1.$2 [L,QSA]

# Rules for: topics
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/?$ ./index.php?pretty;board=$1;topic=$2.0 [L,QSA]
RewriteRule ^([-_!~*'()$a-zA-Z0-9]+)/([-_!~*'()$a-zA-Z0-9]+)/([0-9]*|msg[0-9]*|new)/?$ ./index.php?pretty;board=$1;topic=$2.$3 [L,QSA]

# beginning of directives for Apache Error Handling modification
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)  /smf2/index.php?action=error;code=404
ErrorDocument 400 /smf2/index.php?action=error;code=400
ErrorDocument 401 /smf2/index.php?action=error;code=401
ErrorDocument 402 /smf2/index.php?action=error;code=402
ErrorDocument 403 /smf2/index.php?action=error;code=403
ErrorDocument 404 /smf2/index.php?action=error;code=404
ErrorDocument 405 /smf2/index.php?action=error;code=405
ErrorDocument 406 /smf2/index.php?action=error;code=406
ErrorDocument 407 /smf2/index.php?action=error;code=407
ErrorDocument 408 /smf2/index.php?action=error;code=408
ErrorDocument 409 /smf2/index.php?action=error;code=409
ErrorDocument 410 /smf2/index.php?action=error;code=410
ErrorDocument 411 /smf2/index.php?action=error;code=411
ErrorDocument 412 /smf2/index.php?action=error;code=412
ErrorDocument 413 /smf2/index.php?action=error;code=413
ErrorDocument 414 /smf2/index.php?action=error;code=414
ErrorDocument 415 /smf2/index.php?action=error;code=415
ErrorDocument 416 /smf2/index.php?action=error;code=416
ErrorDocument 417 /smf2/index.php?action=error;code=417
ErrorDocument 500 /smf2/index.php?action=error;code=500
ErrorDocument 501 /smf2/index.php?action=error;code=501
ErrorDocument 502 /smf2/index.php?action=error;code=502
ErrorDocument 503 /smf2/index.php?action=error;code=503
ErrorDocument 504 /smf2/index.php?action=error;code=504
ErrorDocument 505 /smf2/index.php?action=error;code=505
# end of directives for Apache Error Handling modification

Some little difference from original prettyurls htaccess (guestbook, contact and mgalley)  ;)

bjraines

i am about to try it (if my gf doesn't come over and make me get off the comp)

Is there two .htaccess one from pretty url and one for this mod?

Deprecated

Nope, that's the problem, you can't have two files with the same name. Obviously.

Probably the easiest thing you can do is to go ahead with installing the mod, then before you even try to access your forum you should download the .htaccess file and put my stuff at the end.

Everybody should understand that if I reprogram this mod to put my stuff at the end, it could just as easily break other .htaccess configurations. We could be just trading one set of problems for a different set of problems. However, I'm giving this matter a great deal of thought, and if there's a better way of doing it I'm certainly going to look into doing it that way.

You should understand that my modification makes a backup copy of your .htaccess and calls it .htaccess~ so it's not going to leave you up the creek without a paddle. However it wouldn't hurt to back up your file manually. If you have any problems you can always copy over.

I'm also thinking of supplying a version of this mod that leaves the .htaccess alone. It would then require manual .htaccess edits to put it into operation, but it would avoid colliding with Pretty URLs. I'm going to do something about this, but not until the best solution is evident, and I'm not going to do two contradictory things either.

Really, this is a good mod. I think everybody should run it, and I'm trying to work out exactly what the best solution is.

Reverend Jeremiah

Add an Apache Error Handler to SMF review

by Reverend Jeremiah

Rated: ***** (5 stars)

Do you have a massive forum? Did you just upgrade from making your own html web pages to using Simple Machines Forum as your Content Management System? Have you gone from pretty URL's to something that looks like a comic book character cussing you out? Do you think that an "Apache error handler" is an American Native with a tomahawk and a bad attitude? Then this Mods for you!

"Add an Appache error handler to SMF" will fix ALL of your dead links to at least open up a proffessional looking template page as opposed to that white page that says "404 error, page not found" that makes your visitors think your website is no longer up and running. Words cannot express how important having a custom error handler on your site in conjunction with a favicon.ico file on your site is. Do you want your hard earned google and yahoo page caches to pull up a screen that looks like your site is shut down permanent to people who dont know the difference? I suggest that this mod be the VERY FIRST mod you install on your SMF along with somekind of favicon mod (or you can just hard code the favicon into the meta like I did.). This Mod deserves 5 stars because it is quick and effective, and the support forum is wonderfully detailed.

So, do you want that Appache error handler frightening your potential visitors away or do you want to grab him by the balls and turn him into a tour guide? If you have the guts, then go over to this URL (http://custom.simplemachines.org/mods/index.php?mod=1363) and take back control of your site RIGHT NOW!

Deprecated

Please be advised that I have updated this modification for the following:

Version 1.1 (Nov. 25, 2008) Added British and British UTF-8 language strings.

Link to Mod

Existing installations do not need to be upgraded unless they are using British or British UTF-8 language settings and are having language problems.

Melfina

#58
Quote from: Deprecated on November 24, 2008, 11:04:57 AM
I will appreciate more reports on whether Dark Wolf's suggestion works, i.e. to make Pretty URLs and my mod play together by putting my .htaccess data at the end of the file. I was worried that unknown .htaccess commands could prevent my mod from working unless I put my codes at the top. If the suggested fix works then we can add an application note to help Pretty URLs users integrate the Apache Error Handler.

Works for me, just installed it with pretty urls already installed, added the .htaccess rules at the bottom and re-uploaded the .htacess file.
hxxp:foro.rune-nifelheim.com/ [nonactive] ~ hxxp:celestial-star.net/ [nonactive]

L'AltroWeb

#59
I have a small problem with google: http://www.google.it/search?hl=it&q=darkwolf+404&meta=  :-\
Now i've put this in robots.txt:
QuoteDisallow: /forum/index.php?action=error
;)

Advertisement: