Redirecting all old url to home page or any other page in blogger using script
Adding a 301 redirect for every url which has year older then the value we are setting in our script: So why this was needed ? Recently I found in google search console that lot of Page not found errors are triggering for my site and when I looked at the links it was clear that the errors are because the domain was owned by someone else before I got it and google crawlers were still trying to find posts and pages which were published by previous owner. Although there is a option to create a redirect for links in blogger dashboard but doing that for every single url each and every time was too much of work and also this was a blind game as we don't know for which url the error will trigger next until it was being logged in google search console: So here is quick summary for what I did followed by script and the Long explanations. Quick Summary: Get current Url user is visiting on my site>Extract Year part from it>If YearFromUrl(is less then)<YearIStartedWritingP