Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
HTTP Error Response Codes by BOP5 (Soft 404 Solution) Details »»
HTTP Error Response Codes by BOP5 (Soft 404 Solution)
Version: 2.2.1, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.x.x Rating:
Released: 03-10-2014 Last Update: 05-26-2014 Installs: 92
Supported Uses Plugins
Re-useable Code  

Brought to you by BirdOPrey5 / Qapla.com

This issue was brought to my attention by Sherrie at TAZ in this thread.

The issue is that when Google crawls a site and runs into the vBulletin No Permission message or other standard vBulletin error pages vBulletin gives the standard "200" HTTP response code which means everything is OK, even though there is no real content on these pages. Therefore Google considers these "soft errors" and they can damage overall SEO of your site if there are too many of them.

What this does is make vBulletin return standard HTTP "Error" responses- by default 403 (Not Authorized) for No Permission pages and 404 (Not Found) for general error messages. When Google sees these responses (as opposed to 200) it knows not to bother indexing the page and everyone is happy.

As of version 2.2 new options have been added to return custom response codes when the forum is closed or when the forum is busy. It will also send a retry header telling the crawler they can try again later. As of version 2.0 there is also a separate response code for search.php errors.

A limitation of this mod is it works best with PHP 5.4.0 or higher. As of version 2.0 If you are on an older version of PHP it may not work, but it should not cause any errors, so it is worth trying.

There are no instructions, once installed it is enabled by default. In Admin CP -> Settings -> Options -> HTTP Error Responses by BOP5 you can enable/disable the mod and choose the response codes you want for the different error types. You can use any standard HTTP response code available from this list at wikipedia.

The mod works fine on VB 3.x or 4.x including VB 3.8.8 (still in Beta) and VB 4.2.2.

To test that it is working use a free online status checker such as: http://httpstatus.io/
(Note the site will cache your result for a while so test with a unique URL each time.)

Before you install the mod any URL that will show a no-permission or other vBulletin error will show a status code of 200. After installing the same page will show a 403, 404, or other code that you have configured.

Added Boothby as a "co-author" as thanks for his contribution of code and ideas. :up:

------------------------------------------------------

Please "Mark as Installed" if you use this.
Donations always appreciated. :up:
[s]Nominate MOTM if you LOVE it! [/s] (You did, Thanks!)

Download Now

File Type: xml product-httpserrorresponsesbop5-v2.2.1.xml (7.4 KB, 238 views)

Screenshots

File Type: jpg http_codes_ss_settings-v2.jpg (107.6 KB, 0 views)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
10 благодарности(ей) от:
dandanch, DemOnstar, djbaxter, Max Taxable, Mecho, Mickie D, RichieBoy67, SaN-DeeP, tbworld, TheLastSuperman

Comments
  #52  
Old 05-21-2014, 11:15 AM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tested the urls using the site that you provided and do still show status 200.

Quote:
Originally Posted by BirdOPrey5 View Post
You should ignore those- the robots.txt is doing what it is supposed to do.
Cheers Joe, as you say...
Reply With Quote
  #53  
Old 05-21-2014, 12:32 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by addamroy View Post
damn, my host's server (urljet) is using a prior version of php

I was all excited to install this lol
See post 46 b& 48, I have URLjet and it is working with those changes.
Reply With Quote
  #54  
Old 05-21-2014, 12:33 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DemOnstar View Post
I tested the urls using the site that you provided and do still show status 200.
What URL did you test?
Reply With Quote
  #55  
Old 05-21-2014, 02:09 PM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
Wow- I tested this on 3 forums (1 VB 3.8, 2 VB 4.x) and it worked fine on all 3. :up:

You should copy the code to the top of both plugins however.

Do you mind if I add the code to the plugin?
What does this exactly do BOP5? I installed this on my forums using 5.4 "then" reverted my PHP back to 5.3 since my website not my forums wont work with 5.4 ...I have an old version of Joomla as my CMS which is nicely bridged with my VB forums so using 5.4 is not even an option so I have to stick with 5.3..
Reply With Quote
  #56  
Old 05-21-2014, 02:29 PM
Boothby Boothby is offline
 
Join Date: Mar 2002
Location: at home
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
Do you mind if I add the code to the plugin?
Joe, feel free to use this code. I see no problems not to do so. Look at the small source-link. I think this code is too generic so that everyone can use it.
Reply With Quote
  #57  
Old 05-21-2014, 02:46 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Boothby View Post
Joe, feel free to use this code. I see no problems not to do so. Look at the small source-link. I think this code is too generic so that everyone can use it.
Great, thanks! Mod has been updated to version 2.0 to include this code. No longer limited to PHP 5.4.0 or higher.

Quote:
Originally Posted by CAG CheechDogg View Post
What does this exactly do BOP5? I installed this on my forums using 5.4 "then" reverted my PHP back to 5.3 since my website not my forums wont work with 5.4 ...I have an old version of Joomla as my CMS which is nicely bridged with my VB forums so using 5.4 is not even an option so I have to stick with 5.3..
Suggest you upgrade to version 2.0. If it can work, it will work. It should not cause any errors on your site even if the code doesn't work for some reason.

The new code attempts to change the response code if it can (which isn't guaranteed on old PHP versions) but it won't bug out if it can't it just won't do anything.
Reply With Quote
Благодарность от:
CAG CheechDogg
  #58  
Old 05-21-2014, 03:16 PM
addamroy addamroy is offline
 
Join Date: Sep 2010
Posts: 352
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Saweeet.

Installed.
Reply With Quote
Благодарность от:
BirdOPrey5
  #59  
Old 05-21-2014, 03:37 PM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
Great, thanks! Mod has been updated to version 2.0 to include this code. No longer limited to PHP 5.4.0 or higher.

Suggest you upgrade to version 2.0. If it can work, it will work. It should not cause any errors on your site even if the code doesn't work for some reason.

The new code attempts to change the response code if it can (which isn't guaranteed on old PHP versions) but it won't bug out if it can't it just won't do anything.
Good stuff BOP5 and thanks Boothby for the addition !
Reply With Quote
  #60  
Old 05-21-2014, 06:00 PM
Boothby Boothby is offline
 
Join Date: Mar 2002
Location: at home
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I looked in the whole code and I think that this small piece can give false results, when working with the custom pre-5.4 http_response_code() function:

PHP Code:
... http_response_code() != $vbo['bop5he_noperm_err'] ... 
Then I have 2 suggestions:

First I found a way to look for outdated searchids. Second maybe we should send a 503 code for forum closed and server too busy?

PHP Code:
// hook: search_before_process, only for >vB4.0
// outdated searchids
if(is_object($this) AND $this->results === null)
{
    
define('ERR_RESPONSE_CODE'410);

PHP Code:

// ERR_RESPONSE_CODE somewhere defined in the whole wide world?
if(defined('ERR_RESPONSE_CODE'))
{
    
http_response_header(ERR_RESPONSE_CODE);
}
// server to busy
else if($vbulletin->loadcache['loadavg'] > $vbulletin->options['loadlimit'])
{
    
http_response_header(503);
    
header('Retry-After: 60'); // 60 seconds is ok, isn't it?
}
// forum closed
else if(
    !
$vbulletin->options['bbactive']
        AND
    !
in_array(THIS_SCRIPT, array('login''css''mobile'))
)
{
    
http_response_header(503);
    
header('Retry-After: 3600'); // 1 hour, put this in a new option?
}
// and your original code
else if (THIS_SCRIPT == 'search')
{
    
http_response_code($vbo['bop5he_ser_err']);
}
else
{
    
http_response_code($vbo['bop5he_gen_err']);

untested
Reply With Quote
  #61  
Old 05-21-2014, 09:12 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Boothby - These are some great ideas- thanks- I will incorporate most, if not all, into the next version. I will list you as a co-author.

What is the logic behind this line-
PHP Code:
!in_array(THIS_SCRIPT, array('login''css''mobile' 
Why should we check what script it is on if the board is turned off?
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:12 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.06591 seconds
  • Memory Usage 2,376KB
  • Queries Executed 27 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (12)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete