Sunday 15 December 2013

Custom Redirect Blogger " Error 404 " (Page Not Found) To Homepage

 

Halaman 'Error 404' akan terpapar apabila link/url sesuatu halaman tidak dijumpai pada blog anda. Jadi akan muncul halaman seperti gambar diatas yang memaparkan  " Sorry, the page you were looking for in this blog does not exist. " . Sebenarnya anda boleh custom halaman tersebut mengikut kreativiti anda. Disini saya akan tunjukkan cara untuk tambah fungsi redirect ke halaman utama blog apabila berlaku ' Error 404 ' ini.

1. Pada Dashboard blogger anda, klik Settings > Search preferences > Custom Page Not Found (Klik Edit).

2. Copy (CTRL+C) kod dibawah:
Sorry, the page you're looking for in this blog does not exist.
You will be redirected to homepage shortly.
<script type = "text/javascript">
BSPNF_redirect = setTimeout(function() {
location.pathname= "/"
}, 5000);
</script>
3. Paste (CTRL+V) kod diatas pada ruang " Custom Page Not Found " , 
4. Klik Save changes dan lihat hasilnya.

No comments:

Post a Comment