Kirjoittanut Tapio Kauranen
Kirjoitettu: 21.7.2026 - Muokattu: 19.8.2026Sisällysluettelo
When you redesign a site, the URL structure usually changes. That means you need to redirect the old URLs to the new ones.
Otherwise the links in Google’s index will lead to a "404 – page not found" error.
This information is visible in Google Search Console, but Search Console data can be several days out of date.
In this guide I’ll show you how to create the script below that checks links in seconds.
From the site menu, click "Extensions" and open "Apps Script"
function HTTPResponse( uri )
{
var response_code ;
try {
response_code = UrlFetchApp .fetch( uri ) .getResponseCode() .toString() ;
}
catch( error ) {
response_code = error .toString() .match( / returned code (\d\d\d)\./ )[1] ;
}
finally {
return response_code ;
}
}
You can now use a new function in this sheet called =httpresponse.
It lets Google Sheets fetch the status for a given URL.
What do the codes mean?