{"id":42148,"date":"2014-12-15T18:54:53","date_gmt":"2014-12-15T13:24:53","guid":{"rendered":"https:\/\/www.quickonlinetips.com\/archives\/?p=42148"},"modified":"2020-05-24T15:07:31","modified_gmt":"2020-05-24T09:37:31","slug":"wayback-machine-archive-links-to-404-error-pages","status":"publish","type":"post","link":"https:\/\/www.quickonlinetips.com\/archives\/2014\/12\/wayback-machine-archive-links-to-404-error-pages\/","title":{"rendered":"Add Wayback Machine Archive Links to 404 Error Pages"},"content":{"rendered":"<p>Would it not be nice if you could have links on 404 Error pages pointing to Wayback machine Archive.org links on how the pages looked like in the past. Of course there can be no better way for doing this than adding a single line of code which will check the 404 link for \u00a0an archived url.<\/p>\n<p>The <a href=\"https:\/\/archive.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Wayback machine<\/a>\u00a0(Archive.org) archives all your websites at different time periods and has true snapshots of your webpages. It is the best way to find how webpages looked like in the past. When your links go awry, and you are not able to fix all of them, why not point visitors to links of how the page actually looked like in the past.<\/p>\n<h3>Add Archive.org Links<\/h3>\n<p>They suggest you simply add the following <a href=\"https:\/\/blog.archive.org\/2013\/10\/24\/web-archive-404-handler-for-webmasters\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">code<\/a> in your 404 page template. In WordPress, you can add in the <em>404.php<\/em> file while editing your theme template.<\/p>\n<pre><code>&lt;div id=\"wb404\"\/&gt;\r\n&lt;script src=\"https:\/\/archive.org\/web\/wb404.js\"&gt; &lt;\/script&gt;<\/code><\/pre>\n<p>Now when a visitor visits a page which has been indexed in the Wayback machine, it will display the link to the latest copy they stored. See how it looks on our 404 pages right now.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-42151\" src=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/wayback-links.png\" alt=\"wayback archive links\" width=\"499\" height=\"332\" border=\"1\" srcset=\"https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/wayback-links.png 499w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/wayback-links-150x99.png 150w, https:\/\/www.quickonlinetips.com\/archives\/wp-content\/uploads\/wayback-links-300x199.png 300w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><\/p>\n<p>Note: \u00a0If it is a random url, and the script cannot find the link, then it will display a blank space and stay out of the way, which is good.<\/p>\n<p><strong>When\u00a0not to do this?<\/strong>\u00a0If you add this to your 404 page template, the code will display on all 404 pages which have a Archived link. You would not like to implement this feature if you have purposefully deleted the urls and <a title=\"How to Force 404 Errors in WordPress\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2013\/07\/force-404-errors-wordpress\/\">force 404 errors<\/a>, to <a title=\"Delete Urls With Bad Backlinks to Remove Google Penalty\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2013\/06\/delete-urls-with-bad-backlinks-to-remove-google-penalty\/\">fix Google penalties<\/a> or maybe the page is actually gone and you want to display a <a title=\"How to Setup HTTP 410 Error Pages with .htaccess\" href=\"https:\/\/www.quickonlinetips.com\/archives\/2014\/11\/http-410-error-pages-htaccess\/\">410 gone error<\/a> purposefully.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Would it not be nice if you could have links on 404 Error pages pointing to Wayback machine Archive.org links&#8230;<\/p>\n","protected":false},"author":4,"featured_media":42151,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[6,41],"tags":[49,17],"class_list":["post-42148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogging","category-search-engine-optimization","tag-tutorials","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/42148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/comments?post=42148"}],"version-history":[{"count":0,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/posts\/42148\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media\/42151"}],"wp:attachment":[{"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/media?parent=42148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/categories?post=42148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickonlinetips.com\/archives\/wp-json\/wp\/v2\/tags?post=42148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}