·   Log in
Inna lillahi wa Inna Ilaihi raji'un telah berpulang ke rahmatullah Syaikhul Azhar Asy-Syarif Prof.DR. M. Sayyid Tantawi pada hari Rabu tanggal 10 maret 2010 di Jeddah Saudi Arabia. semoga Allah SWT mengampuni segala dosa-dosanya, dan menerima segala amal sholehnya, amin ya rabbal 'alamin

WordPress 404 Redirect And 404 Custom Message

Written by: Teungku on 8th October 2009
Bookmark and Share
error not fund
WordPress 404 Redirect And 404 Custom Message  | read this item

Related post

The WordPress 404 error page or the 404 error message is probably the file or piece of code most neglected by WordPress theme authors. This short WordPress guide will show you how to spruce yours up a bit.

Keeping visitors on your WordPress blog should be one of your main objectives to blogging. When they find themselves on a dead end they may just leave. Why not entice them to look around a bit, redirect them to a different page, or place some AdSense on your 404 page and at least get paid when they leave your site.

First check yours out by typing in URL on your blog that you know doesn’t exist. Most WordPress blogs show something like this:

404.jpg

Well that is really wanting me to do something like… leave! WordPress handles 404 errors differently than an HTML site and creating a 404 redirect in your .htaccess file will not work, at least that I know of. The 404 error that is displayed is theme specific and has to be edited within the themes files. So switching themes means these changes will not follow.

Next determine if you have a separate 404.php file with your theme or if it uses some code in the themes main index file (index.php). From within the WordPress dashboard click Presentation then Theme Editor. Look on the right side for the 404.php file. If you have a 404.php file you can make the changes to it. If you don’t have a separate 404.php file you can create one or make the changes you want in the index.php file.

If you have a current 404.php file and want to redirect visitors to another URL. Or to make your own 404.php file to redirect your visitors to another URL place the following code into a text file, change the URL and save it as 404.php and upload it to your current WordPress themes directory:

<?php

header(”Status: 301 Moved Permanently”);

header(”Location:http://www.ChangeToTheURL.com”);

?>

Do not copy the code from the post! Click here to open the proper text file to copy.

Now if you want to display something more interesting on your 404 error page you can edit your 404.php file or find where in your index.php file to make the changes. To determine where the code is in the index.php file open it in the Theme Editor and look for this piece of code:

<?php else : //if there were no posts available ?>

You can now edit what you want between that bit of code in your index.php file and the next line of code. You can start by changing the text between the h2 tags shown below:

<h2>Error 404 – Not Found</h2>

You can also add a few links and more text below the h2 tags and even some AdSense code if you want. I added a search box for my blog and some AdSense. Make sure you backup any file you are editing first so if you don’t like your changes or break your blog you can restore it easily.

Here is a sample of what I used to create the 404 error message on this site: You can use this in either your index.php or 404.php file: Sample 404 Error You can add more space between items with a few more breaks <br/> if you like.

Well what started out as short guide has grown bigger than I thought and there are many other items you can place in the 404 error area of your blog. Just make sure you close all the tags and make a backup before you start hacking the code!

By : http://www.wordpressmax.com

Topics:


Top incoming search terms for this post




Latest post

In The New

A Plugin Broke Your WordPress Blog? Here Is What To Do thumbnail

A Plugin Broke Your WordPress Blog? Here Is What To Do

by Daniel Scocco Most WordPress users had this experience at least once. You find a cool plugin around the web, rush to upload it to your server, activate it, and then when you check the blog to see if its working, bang! The blog crashes and you can’t even load the homepage….
Wujud Syukur dengan Hati, Lisan dan Perbuatan thumbnail

Wujud Syukur dengan Hati, Lisan dan Perbuatan

Assalamualaikum Wr Wb Bissmillahirrohmman irrohiim “Ya Tuhanku, berilah aku ilham untuk tetap mensyukuri nikmat-Mu yang telah Engkau anugerahkan kepadaku dan kepada dua orang ibu bapakku dan untuk mengerjakan amal saleh yang Engkau ridhai; dan masukkanlah aku dengan rahmat-Mu ke dalam golongan hamba-hamba- Mu yang saleh”. Incoming search terms for the article:tafsir surat an nahl ayat 78
Bumi Planet Yang diciptakan Untuk Manusia thumbnail

Bumi Planet Yang diciptakan Untuk Manusia

Bissmillahirrohmaan irrohiim “Dan kepunyaan-Nya- lah segala apa yang ada di langit dan di bumi, dan untuk-Nya-lah ketaatan itu selama-lamanya, maka mengapa kamu bertakwa kepada selain Allah ?, dan apa saja nikmat yang ada pada kamu, maka dari Allah-lah (datangnya), dan bila kamu ditimpa oleh kemudaratan, maka hanya kepada-Nya-lah kamu meminta pertolongan”. QS. An-Nahl 16:52-53.
Surah Al-Baqarah ayat 121-130 thumbnail

Surah Al-Baqarah ayat 121-130

الَّذينَ ءاتَينٰهُمُ الكِتٰبَ يَتلونَهُ حَقَّ تِلاوَتِهِ أُولٰئِكَ يُؤمِنونَ بِهِ ۗ وَمَن يَكفُر بِهِ فَأُولٰئِكَ هُمُ الخٰسِرونَ Orang-orang yang telah Kami berikan Al Kitab kepadanya, mereka membacanya dengan bacaan yang sebenarnya, mereka itu beriman kepadanya. Dan barang siapa yang ingkar kepadanya, maka mereka itulah orang-orang yang rugi.
MUSIBAH SEBAGAI KASIH SAYANG ALLAH thumbnail

MUSIBAH SEBAGAI KASIH SAYANG ALLAH

Oleh Dr. Aidh Al-Qarni Musibah itu akan mendekatkan anda kepada Allah, Mengajarkan anda untuk berdoa, Menghilangkan kesombongan anda, sikap ujub dan kebanggaan