Hi @reiniggen
I hope you’re well today!
I just tested this particular YT URL on two test setups of mine, using my own API key, and in both cases I couldn’t replicate that issue.
Both setups checked this link and returned it as not broken with “200 OK” HTTP status.
The error that you are getting seems to come down to that “empty referrer” part (as you already noticed in initial post) but I’m wondering why it even is empty. It seems that there is something specific either on site or on server that does that as Broken Link Checker doesn’t really attempt to manipulate it in anyway.
Can you try a small test, please?
1. enable WordPress debugging on site by adding following lines to the “wp-config.php” file of your site, right above the “/* That’s all, stop editing */” line:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG", true );
2. then add this code to the sit as Must Use plugin:
<?php
add_filter( 'http_request_args', 'blc_test_http_response_args', 999, 2 );
function blc_test_http_response_args( $args, $url ) {
if ( strpos( $url, 'youtube' ) !== false ) {
error_log( print_r( $args, true ) );
}
return $args;
}
– create an empty file with a .php extensions (e.g. “blc-args-test.php”) in the “/wp-content/mu-plugins” folder of your site’s WordPress install
– copy above code and paste it into that file
– save the file
3. then in Broken Link Checker find that YT link where it’s reported as broken and click “recheck” option.
4. after that look into the file “/wp-content/debug.log” on the server and
a) see if there are any errors/fatal errors or similar reported that may seem related to Broken Link Checker
b) and look for output similar to this:
[19-Mar-2024 14:36:18 UTC] Array
(
[method] => GET
[timeout] => 30
[redirection] => 5
[httpversion] => 1.0
[user-agent] => WordPress/6.4.3; https://yoursite.here
[reject_unsafe_urls] =>
[blocking] => 1
[headers] => Array
(
)
[cookies] => Array
(
)
[body] =>
[compress] =>
[decompress] => 1
[sslverify] => 1
[sslcertificates] => /some-path-here/certificates/ca-bundle.crt
[stream] =>
[filename] =>
[limit_response_size] =>
)
If it’s there (or there are errors), share it with us (note: you may want to mask path in the [sslcertificates] line for safety).
Best regards,
Adam