vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Mini Mods - HTTP Error Response Codes by BOP5 (Soft 404 Solution) (https://vborg.vbsupport.ru/showthread.php?t=309415)

PattiOz 05-07-2014 06:52 AM

Brilliant. Perfect. Works like a charm! My SEO thanks you.

Boothby 05-17-2014 07:21 AM

Hi Joe. Could you add the following codes for search-results?

404 Not Found for no result found

410 Gone for outdated search-ID

When a distinction is not possible then the 410 code should be presented.

Thx

BirdOPrey5 05-17-2014 11:09 AM

Quote:

Originally Posted by Boothby (Post 2498126)
Hi Joe. Could you add the following codes for search-results?

404 Not Found for no result found

410 Gone for outdated search-ID

When a distinction is not possible then the 410 code should be presented.

Thx

Please "Mark as Installed"


Updated to version 1.1
. I wasn't able to determine whether it was no results found or outdated id however, so I added a new setting that will be the response code for any search.php errors. The default response for this is now 410.

I also added code that will prevent the mod from breaking your site if you install it on PHP 5.4+ but later you or your web host downgrade back to PHP 5.3. (Which happened to me.)

This was a minor code change so I believe it worked but I was unable to test it- if someone could test and confirm it works I'd appreciate it.

Boothby 05-17-2014 09:36 PM

Thx Joe. The question came from a member of vb-germany.org who wanted a 404 status code for search. And your mod was the closest. And now it fits perfectly. ;)

BirdOPrey5 05-18-2014 01:38 AM

Thanks. I would like to add however the better way would be for search.php to be off limits via a robots.txt file so Google doesn't try to index search links at all.

This is a generic VB robots.txt file for a forum in the /forums/ directory of a website-

Code:

User-agent: *
Disallow: /forums/admincp/
Disallow: /forums/clientscript/
Disallow: /forums/cpstyles/
Disallow: /forums/customavatars/
Disallow: /forums/customprofilepics/
Disallow: /forums/images/
Disallow: /forums/modcp/
Disallow: /forums/attachment.php
Disallow: /forums/editpost.php
Disallow: /forums/image.php
Disallow: /forums/misc.php
Disallow: /forums/moderator.php
Disallow: /forums/newattachment.php
Disallow: /forums/newreply.php
Disallow: /forums/newthread.php
Disallow: /forums/online.php
Disallow: /forums/poll.php
Disallow: /forums/postings.php
Disallow: /forums/printthread.php
Disallow: /forums/private.php
Disallow: /forums/profile.php
Disallow: /forums/register.php
Disallow: /forums/report.php
Disallow: /forums/reputation.php
Disallow: /forums/search.php
Disallow: /forums/sendmessage.php
Disallow: /forums/subscription.php
Disallow: /forums/threadrate.php
Disallow: /forums/usernote.php


Boothby 05-21-2014 07:04 AM

Those who have < PHP5.4 can add the following at the beginning of the error_generic plug-in and test it. This is a non standardized method, so it may or may not work.

PHP Code:

if (!function_exists('http_response_code'))
{
    function 
http_response_code($newcode NULL)
    {
        static 
$code 200;
        if(
$newcode !== NULL)
        {
            
header('X-PHP-Response-Code: '.$newcodetrue$newcode);
            if(!
headers_sent())
                
$code $newcode;
        }       
        return 
$code;
    }


source: http://www.liketly.com/forum/thread/...response-code/

Thanks to RolandCP for the hint.

DemOnstar 05-21-2014 08:31 AM

1 Attachment(s)
I have 96 warnings from webmaster tools.

https://vborg.vbsupport.ru/attachmen...1&d=1400664625

Not entirely sure how to deal with them and if this is the correct procedure but installed to see what happens.

BirdOPrey5 05-21-2014 10:17 AM

Quote:

Originally Posted by Boothby (Post 2498747)
Those who have < PHP5.4 can add the following at the beginning of the error_generic plug-in and test it. This is a non standardized method, so it may or may not work.

PHP Code:

if (!function_exists('http_response_code'))
{
    function 
http_response_code($newcode NULL)
    {
        static 
$code 200;
        if(
$newcode !== NULL)
        {
            
header('X-PHP-Response-Code: '.$newcodetrue$newcode);
            if(!
headers_sent())
                
$code $newcode;
        }       
        return 
$code;
    }


source: http://www.liketly.com/forum/thread/...response-code/

Thanks to RolandCP for the hint.

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?

BirdOPrey5 05-21-2014 10:17 AM

Quote:

Originally Posted by DemOnstar (Post 2498757)
I have 96 warnings from webmaster tools.

https://vborg.vbsupport.ru/attachmen...1&d=1400664625

Not entirely sure how to deal with them and if this is the correct procedure but installed to see what happens.

You should ignore those- the robots.txt is doing what it is supposed to do.

addamroy 05-21-2014 10:28 AM

damn, my host's server (urljet) is using a prior version of php :(

I was all excited to install this lol


All times are GMT. The time now is 11:18 AM.

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.01387 seconds
  • Memory Usage 1,754KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete