If you’ve got a lot of links out there pointing to a missing page on your Wordpress blog, why not 301 redirect them to your main page by downloading THIS FILE. That way you can funnel all the link juice at your main hog (industry terms).
Unzip it and upload the 404.php file into your template directory with all the other files (index.php, single.php, etc.php) Then give it a shot.

18 responses so far ↓
1 Kimmono // Dec 18, 2006 at 3:15 am
I totally love your work Dax, but this one I just did not get working.
I put it in the Template directory of the theme I have activated, but just got up a blank page when entering a URL that does not exist.
Do you think the problem is related to a conflict with another Plugin?
2 hammer // Dec 18, 2006 at 10:07 am
Hmmm could be.
Did you put it on kservik.com?
3 Kimmono // Dec 20, 2006 at 1:56 pm
No, I put it on http://visithaugesund.org.
It is not active now as I get a lot of 404´s by redirecting from other sites (no fishy stuff), but if it could help you understand the problem I can turn it on again?
Thanks for taking the time to reply, Dax!
Kim
4 Kimmono // Dec 20, 2006 at 2:14 pm
I did install it on kservik.com now and put in into the template I was using. That did not work.
Now I have changed to the default template (thought it maybe was a template issue). I renamed the existing 404 file to 404-bak and uploaded the file the file you made and I got the same error:
http://kservik.com/asdfg
Any ideas?
5 hammer // Dec 20, 2006 at 3:42 pm
Hmmm…and if you have your old 404.php file in there, does it work? Does it load that file correctly when you navigate to a page that doesn’t exist?
you can try editing my 404.php file and putting your blog url in instead of the get_bloginfo() function
then it would look like this:
header(”Location: http://kservik.com“);
6 Kimmono // Dec 20, 2006 at 7:11 pm
That did not work either.
7 Ahkip // Dec 21, 2006 at 2:08 pm
change the second link to
include(get_bloginfo(’url’));
it works for me
8 hammer // Dec 21, 2006 at 2:38 pm
Did some of that comment get cut off Ahkip? If it did, run it through an htmlentities encoder before posting.
9 ahkip // Dec 30, 2006 at 7:27 pm
yea, here ya go
<?php
//dax totally wrote this.
//biggnuts.com
header("HTTP/1.1 301 Moved Permanently");
include(get_bloginfo(’url’));
exit();
?>
10 Twolane // Mar 26, 2007 at 10:58 am
I’ve got WP212 on my domain, thus this doesn’t work because error pages are called from somewhere else. Any suggestions?
11 hammer // Mar 26, 2007 at 11:20 am
The 404.php isn’t called in your theme?
I have 212 installed and it works.
12 Twolane // Mar 26, 2007 at 11:30 am
Well, I get the normal white Not Found page with The requested URL /nope was not found on this server. That’s it.
13 hammer // Mar 26, 2007 at 11:44 am
did you put the 404.php file in your template directory?
14 Twolane // Mar 26, 2007 at 11:47 am
Yes. In the current template dir. Still nada. I also tried the recommended editing, above.
15 Twolane // Mar 26, 2007 at 11:50 am
Don’t sweat it. I’m a newbie. I’ll figger in out eventually.
16 hammer // Mar 26, 2007 at 3:07 pm
Hmm…that’s weird.
17 Hayal // Mar 29, 2007 at 5:09 am
Very useful work. Thanks Hammer.
18 Michael Weir // Nov 30, 2007 at 2:55 am
Your default 404.php works perfectly, but I would like to redirect to a different url.
I’ve tried using this line:
header(”Location: http://myurlhere.blah“);
It refuses to redirect.
Help?
Leave a Comment