Broken, Deleted and Damaged Links Repair via Cloudflare
Broken links are broken links, meaning that the link on the target blog no longer exists (404 error). Either a link on the blog itself, or external (outside the blog)
Broken links are broken links, meaning that the link on the target blog no longer exists (404 error). Either a link on the blog itself, or external (outside the blog)
The impact of broken links on SEO
Of course it will be very influential and very bad. As a blogger, you of course not only face the device, but also the user (user experience). What happens when some users click on a link and the link is not there. It is unlikely that they will return to our blog.Reasons for broken links
Among the reasons for broken links are:- Writing the content incorrectly / typo
- Changing the permalink
- Deleting the post / file URL
- Changing the redirection to self-hosting
- Replacing the domain or custom domain / domain
- Changing the dll ...
How to check for broken links
To check if there is a broken link on our blog or not, we can use the online tool brokenlinkcheck.com
1. Create Agent > Create Agent, copy the script (edit the code with your information, for example, I have a contact us page with a redirect problem, so I replaced the old link to the broken page with the new and working link to the page)
2. Then rename it for example 301-mui
3. Create Route > Add Route
Use *www.en.naljaede.com/* replace with your domain name, the created operator for example 301-mui
Solutions
The best solution is of course to fix the link, but when there are too many links that take time to edit, we can use Cloudflare firstUsing Cloudflare for broken links
There are several steps to use Cloudflare (of course the blog must already be using Cloudflare DNS)1. Create Agent > Create Agent, copy the script (edit the code with your information, for example, I have a contact us page with a redirect problem, so I replaced the old link to the broken page with the new and working link to the page)
const OLD_URL = "https://www.en.naljaede.com/p/contact.html"
const NEW_URL = "https://www.en.naljaede.com/p/post-contact-form.html"
async function handleRequest(req) {
const res = await fetch(req)
return rewriter.transform(res)
}
class AttributeRewriter {
constructor(attributeName) {
this.attributeName = attributeName
}
element(element) {
const attribute = element.getAttribute(this.attributeName)
if (attribute) {
element.setAttribute(
this.attributeName,
attribute.replace(OLD_URL, NEW_URL),
)
}
}
}
const rewriter = new HTMLRewriter()
.on("a", new AttributeRewriter("href"))
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
3. Create Route > Add Route
Use *www.en.naljaede.com/* replace with your domain name, the created operator for example 301-mui
Show Comments