The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
404 header on empty threads
When no thread exists, the error page that's says "No Thread specified. If you followed a valid link, please notify the administrator." actually returns a 200 OK header rather than a 404.
Does anyone know how I can modify vbulletin to ensure error pages return a hard 404. Thanks! |
#2
|
|||
|
|||
You can do it, but you have add some redundant code to make it happen.
The verify_id() function is what generates that error, so if you want to preempt it you have to throw in a check before it gets called and override what it would've done. Add a plugin that is triggered by showthread_start Code:
if (!$check = $vbulletin->db->query_first('SELECT threadid FROM ' . TABLE_PREFIX . 'thread WHERE threadid = ' . $vbulletin->db->escape_string( $vbulletin->GPC['threadid']) )) { // If using fastcgi this is the 404 header // header("Status: 404 Not Found"); // otherwise this is the standard 404 header("HTTP/1.0 404 Not Found"); } If you want to actually pass the handling to your webserver's error handling document you'd need to either include the error document after it and exit, or similar. |
#3
|
|||
|
|||
Thanks alot Eosian, I am looking for this solution for a long. Your solution have worked perfectly for me. But I am getting one more soft error http://www.techhotfix.com/forum/sear...155&pp=&page=3 in search.php. Please help me this type of broken links returning 200 response code or soft 404 instead of 404 error page not found. Please help
|
#4
|
|||
|
|||
Should be approximately the same but you use search_intro as your hook and the test for whether or not an error has occurred would be to check either empty($errors) or !$show['errors'] (either of those checks, both shouldn't be necessary because the show is set earlier by the $errors variable).
You could probably also use search_complete as the hook, but any other hooks on search_intro could potentially change the results before search_complete is called. |
#5
|
|||
|
|||
My brother, actually I have very little knowledge of programming. So please gimme code which have you given in post number 2. Thank You.
|
#6
|
|||
|
|||
Add a plugin that is triggered by search_intro
Code:
if ( !empty($errors) ) { // If using fastcgi this is the 404 header // header("Status: 404 Not Found"); // otherwise this is the standard 404 header("HTTP/1.0 404 Not Found"); } |
#7
|
|||
|
|||
Hi, above solution is not working brother.
Please check out this link http://www.techhotfix.com/forum/sear...505&pp=&page=2 and i want 404 error but it showing 200 response code. Try to give me some other solution. Thank You. |
#8
|
|||
|
|||
Please help me brother.
|
#9
|
|||
|
|||
Anybody here to help me....
--------------- Added [DATE]1363180009[/DATE] at [TIME]1363180009[/TIME] --------------- This is not working.... |
#10
|
|||
|
|||
Create a plugin hook on the `init_startup` hook, place the following code in, and save.
PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|