News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

[Google Search Console] A lot of error 404 due to cron.php

Started by Saiy, July 20, 2024, 05:32:43 PM

Previous topic - Next topic

Saiy

Hello guys,


My website is www.db-z.com [nofollow], but my forum is in www.db-z.com/forum [nofollow] (that's very important for the following problem).

In Google Search Console, I have like +40k error 404 caused by the cron.php code, like this one :

This error 404 : https://www.db-z.com/cron.php?ts=1720894020 [nofollow]

Found by Google on this page : https://www.db-z.com/forum/index.php/topic,4019.6285.html [nofollow]
And indeed, in the source code of this page, there's this :

window.addEventListener("DOMContentLoaded", function() {
function triggerCron()
{
$.get('https://www.db-z.com/forum' + "/cron.php?ts=1721510745");

The funny thing is......... My forum "home" is https://www.db-z.com/forum [nofollow], so why Google tells me there's a 404 with this URL ? --> https://www.db-z.com/cron.php?ts=1720894020 [nofollow] (without the "/forum" in the URL).

Thank you

Arantor

Because Google is mis-reading the URL. It sees the /cron.php part and visits it without realising it's wrong because it assumes it is your domain + /cron.php, namely db-z.com/cron.php

I wouldn't normally encourage this but the quickest fix is to change Sources/Load.php:

$.get(' . JavaScriptEscape($boardurl) . ' + "/cron.php?ts=' . $ts . '");
to
$.get("https://www.db-z.com/forum/cron.php?ts=' . $ts . '");
The problem is that writing the logic to correctly decompose $boardurl like this is not the easiest in the world and I'm not sure there aren't weird bugs that will happen otherwise. But this way will be consistent for you if nothing else.
Holder of controversial views, all of which my own.


shawnb61

I just updated robots.txt & now Google leaves it alone.
A question worth asking is born in experience & driven by necessity. - Fripp

Arantor

Hopefully you have enough active visitors to keep triggering scheduled tasks in the meantime?
Holder of controversial views, all of which my own.


Saiy

Quote from: shawnb61 on July 20, 2024, 07:33:56 PMI just updated robots.txt & now Google leaves it alone.

Thank you so much @Arantor ! I wanted to avoid to manually modify the source files but yes, Google is really spamming me. ;D

@shawnb61 : I tried to do it yesterday also : Disallow: /cron.php

Advertisement: