Skip to content

Instantly share code, notes, and snippets.

@vrypan
Created Nov 23, 2012
Embed
What would you like to do?
smart redirects from 404 pages.
<script>
$.getJSON('/_/js/url_mapper.json', function(data) {
path = location.pathname.split("/") ;
if ( path[1] == "post" ){
id = path[2];
if ( data[id] ) {
$('#msg_en').html("The page you are looking has probably moved to \<a href=\"" + data[id] + "\"\>" + data[id] + "\</a\>.") ;
}
}
});
// See http://blog.vrypan.net/2012/11/23/dynamic-404-for-static-blogs/
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment