vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Miscellaneous Hacks - Custom HTTP Error Pages (https://vborg.vbsupport.ru/showthread.php?t=207490)

JamesAB 03-05-2009 10:00 PM

Custom HTTP Error Pages
 
1 Attachment(s)
About this hack:
This hack allows you to use vBulletin template driven pages for 400, 401, 403, 404 and 500 webserver error pages that will perfectly match your own forum's design. Five custom pages are added to your forum by this hack. You can then instruct your webserver to use these pages for it's error pages.

Features:
  • Error pages will still work even if your forum is turned off in the AdminCP.
  • Admin CP option to automatically redirect to your forum's main page after the error page is shown for 5 seconds.
  • Admin CP option to show or hide notices on error pages.

Installation information on hack:
  • Files to upload: 5
  • New templates added: 5
  • Time to install: 10 minutes.
You can test that the pages are working correctly by visiting:
<URL OF YOUR FORUM HOME>/400_forum.php
<URL OF YOUR FORUM HOME>/401_forum.php
<URL OF YOUR FORUM HOME>/403_forum.php
<URL OF YOUR FORUM HOME>/404_forum.php
<URL OF YOUR FORUM HOME>/500_forum.php
Next you will need to edit your webserver's configuration file or add lines into an .htaccess file.
.................................................. ..........
If your forum directory is the same as your website's document root, add these lines:
Code:

ErrorDocument 400 /400_forum.php
ErrorDocument 401 /401_forum.php
ErrorDocument 403 /403_forum.php
ErrorDocument 404 /404_forum.php
ErrorDocument 500 /500_forum.php

.................................................. ..........
If your forum is located in a directory within your website's document root, you'll need to replace <forum_directory> with the directory of your forum in these lines:
Code:

ErrorDocument 400 /<forum_directory>/400_forum.php
ErrorDocument 401 /<forum_directory>/401_forum.php
ErrorDocument 403 /<forum_directory>/403_forum.php
ErrorDocument 404 /<forum_directory>/404_forum.php
ErrorDocument 500 /<forum_directory>/500_forum.php

.................................................. ..........
  • You can easily customize the templates for each indivual error page.
    The templates can be found grouped together under HTTP Error Templates.
  • For the purpose of this hack, I used very generic error messages.
    You can easily edit any of the phrases to best suit your site.
    Each page uses three different vBulletin phrases.
    1. The error name in the navbit. (for example... jab_404_error_navbit )
    2. The title of the error table. (for example... jab_404_error_title )
    3. The message shown for the error. (for example... jab_404_error_message )

Updates:

Version 1.0 (03/05/09):
  • Release of this hack for vBulletin version 3.8.0

MAKE SURE YOU CLICK INSTALL!

Screenshots:
These show the five error pages in vBulletin's default style.
Your pages will use your own forum's style and look just like your other pages.
In the "400 Bad Request" screen shot, I indicated the three phrases that can be edited.

Robru 03-06-2009 06:40 PM

Perfect mod, thanks :)

James Desalus 03-06-2009 06:59 PM

That's awesome, thanks.

saihat 03-06-2009 07:03 PM

thanks

vithorius 03-06-2009 08:48 PM

SIMPLY PERFECT!!! :p


Thank you! :up: :up:

C138 Kaysone 03-09-2009 12:24 AM

I installed but some reason its not really working for me like i want it to redirect to the error pages but mistyping a link it still doesnt send me there

ZEN~ 03-09-2009 02:08 AM

Just Keeps Going Up!
Good work..
I go to test it..

JamesAB 03-09-2009 04:04 AM

Quote:

Originally Posted by C138 Kaysone (Post 1763604)
I installed but some reason its not really working for me like i want it to redirect to the error pages but mistyping a link it still doesnt send me there

Can you see the pages when you put direct links to the URLs in your browser?
Are you using the ErrorDocument lines in an .htaccess file or in your webserver's configuration file?

Thanks,
James

Hitterman 03-10-2009 09:52 AM

Great hack. I will surely use it. No need to modify CSS for custom pages now to match it with forum skin

Jasem 03-27-2009 08:03 PM

Installed, Great looking mod. keep up the good work.

Thanks,

PossumX 03-28-2009 09:56 AM

Nice addition. One note is that it only works properly if the Store CSS Stylesheets as Files? option is set to No. When yes, the style is ignored, and it looks horrible. Would be great if you could integrate the usage of CSS Stylesheet files as well.

JamesAB 03-28-2009 12:28 PM

Quote:

Originally Posted by PossumX (Post 1778848)
Nice addition. One note is that it only works properly if the Store CSS Stylesheets as Files? option is set to No. When yes, the style is ignored, and it looks horrible. Would be great if you could integrate the usage of CSS Stylesheet files as well.

On my forum, I have always had Store CSS Stylesheets as Files? set to Yes and it is working properly.
I'm not sure I completely understand the problem and why you are having trouble. :confused:

Thanks,
James

PossumX 03-29-2009 06:53 PM

Must conflict with something else. >>uninstalled<<

RedDevil 03-29-2009 07:43 PM

Installed didnt work using the .htaccess file set in server settings.

nice mod.

711 04-05-2009 02:35 PM

Nice hack, very useful :up:

Any reason why lots (nearly half) of my active members would be shown in the Who's Online listing as this:

Unknown Location
/forum/404_forum.php

I'm really stumped.

711 04-05-2009 06:22 PM

Quote:

Originally Posted by 711 (Post 1784296)
Nice hack, very useful :up:

Any reason why lots (nearly half) of my active members would be shown in the Who's Online listing as this:

Unknown Location
/forum/404_forum.php

I'm really stumped.

Even when I globally disable the plugin system, I still see

Unknown Location
/forum/404_forum.php

on the Who's Online page as well as member profiles :confused::confused:

JamesAB 04-05-2009 08:49 PM

Quote:

Originally Posted by 711 (Post 1784296)
Nice hack, very useful :up:

Any reason why lots (nearly half) of my active members would be shown in the Who's Online listing as this:

Unknown Location
/forum/404_forum.php

I'm really stumped.

I don't have an answer for you, because this mod does not implement adding the error pages as locations in the Who's Online listings.

I just looked at a forum with about 500 people online and didn't see anything out of the ordinary and I didn't see any viewing these custom error pages.

I suggest you check for other mods you may have installed that might effect the Who's Online list.

Thanks,
James

711 04-05-2009 09:57 PM

Quote:

Originally Posted by JamesAB (Post 1784586)
I don't have an answer for you, because this mod does not implement adding the error pages as locations in the Who's Online listings.

I just looked at a forum with about 500 people online and didn't see anything out of the ordinary and I didn't see any viewing these custom error pages.

I suggest you check for other mods you may have installed that might effect the Who's Online list.

Thanks,
James

It happens even when I set the "Enable Plugins" Admin CP setting to "No", so I don't think this is being caused by a plugin (including yours).

I just notice that this didn't start happening until I installed your plugin, and am very confused why it would be showing your 404_forum.php page as the current location.

I even totally uninstalled your mod, but the online location still shows as 404_forums.php.

711 04-06-2009 01:05 AM

Fixed it. It seems the problem was being caused by session variables.

For others who might notice the same issue, simply add the following line near the top of 404_forums.php:

Code:

define('SKIP_SESSIONCREATE', 1);

djbaxter 04-06-2009 04:29 PM

Quote:

Originally Posted by 711 (Post 1784725)
Fixed it. It seems the problem was being caused by session variables.

For others who might notice the same issue, simply add the following line near the top of 404_forums.php:

Code:

define('SKIP_SESSIONCREATE', 1);

That doesn't necessarily fix the problem and what it definitely will do is make your members who reach the error page think they've been logged out when in fact they're still logged in.

hambil 04-06-2009 06:07 PM

Templates need to be cached - also, WOL support would be nice :)

Namaless 04-27-2009 07:45 PM

1 Attachment(s)
Italian Language for 1.00

nohuhu 05-02-2009 06:43 PM

1 Attachment(s)
Russian translation for this useful mod.

chick 05-14-2009 09:11 PM

wol support is a must but I have to say it didn't work for me either, I can get to the pages manually but when hitting real error none of the error pages show.

I use this in my .htaccess

ErrorDocument 400 /400_forum.php
ErrorDocument 401 /401_forum.php
ErrorDocument 403 /403_forum.php
ErrorDocument 404 /404_forum.php
ErrorDocument 500 /500_forum.php

it did not work.

I can add it to my docs on my server (it is my server) but how exactly do I do that please?

chick 05-16-2009 06:04 PM

James since I installed and uninstalled your product and deleted all the error.php pages my shtml error pages will no longer work (at least they use to work) can you please help and tell me what to do.

I think there is something left over in the database that is now preventing my shtml pages from working, can you please help?

s8glive 05-18-2009 06:34 PM

the code does not fully load in safri

g_noe 05-18-2009 09:18 PM

great mod.thanks :):)

Saviour 05-25-2009 01:37 PM

Quote:

Originally Posted by PossumX (Post 1778848)
Nice addition. One note is that it only works properly if the Store CSS Stylesheets as Files? option is set to No. When yes, the style is ignored, and it looks horrible. Would be great if you could integrate the usage of CSS Stylesheet files as well.

Same for me, as well.

Running vB 3.8.2 and vBA CMPS v3.2.0

Also, the header, navbar and footer links are not pointing to the correct pages...from the error pages.

Saviour 05-25-2009 03:47 PM

Uninstalled...until all the bugs are sorted.

Silver Tiger 05-30-2009 10:01 PM

If theres one for vbulletin 3.7 it would be great :up:

4nawadir.com 05-30-2009 10:20 PM

Installed & Notaminated , Great looking mod. keep up the good work.

Thanks,

GhoHan 06-06-2009 03:20 PM

ErrorDocument 401 /401_forum.php Not Working on vb 3.8.2

nohuhu 06-25-2009 07:10 PM

a bug found in these scripts: by default they don't modify http header your server gives out with the page so for any of these errors the header will contain 200 OK instead of corresponding error. found this accidentally while trying to find out why google doesn't want to authorize me for my website. :)
this is easily enough fixed by adding the following line near the top of script:
Code:

header("HTTP/1.0 404 Not Found");
change 404 not found to corresponding error for each file. works for me, at least google stopped complaining. :)

Sc00by22 06-26-2009 10:45 AM

Installed, works perfectly :)

Do I put header("HTTP/1.0 404 Not Found"); near the top of the file "404_forum.php"

nohuhu 06-27-2009 04:22 PM

Sc00by22,

i'd recommend you to do so. in my experience, 404 is one of the most important error codes and giving out 200 OK when a page is not found can be very misleading for search engines. their crawlers don't actually read pages content, you know, they rely on http status codes.

deadlySniper 06-27-2009 04:28 PM

Nice, thanks.

TheInsaneManiac 11-11-2009 04:08 AM

I get a white page with the http errors on it...

Abdullah SZ 11-16-2009 02:14 AM

Quote:

Originally Posted by nohuhu (Post 1837324)
a bug found in these scripts: by default they don't modify http header your server gives out with the page so for any of these errors the header will contain 200 OK instead of corresponding error. found this accidentally while trying to find out why google doesn't want to authorize me for my website. :)
this is easily enough fixed by adding the following line near the top of script:
Code:

header("HTTP/1.0 404 Not Found");
change 404 not found to corresponding error for each file. works for me, at least google stopped complaining. :)

Can someone tell if this should be after <?php or before?

Quote:

Originally Posted by TheInsaneManiac (Post 1912637)
I get a white page with the http errors on it...

Same here.

egclive 01-31-2010 02:32 AM

is this going to be modded for vb4.0

egclive 04-14-2012 02:27 AM

Will this work on vbuleltin 4 series lol


All times are GMT. The time now is 07:13 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01402 seconds
  • Memory Usage 1,823KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete