How to 301 redirect 404 pages in wordpress?

jon_xx_x

Elite Member
Joined
Nov 15, 2008
Messages
3,476
Reaction score
1,617
Can someone tell me code to use so I can 301 404 pages (expired aged domain links), to the main domain?
I usually use a plugin but it's giving me site errors.
 
Doing a quick search the plugin '404 redirected' may be of use
 
Thanks, I'll try it. Hopefully it works on my host.
 
put this in .htaccess (in root folder) and save

redirect 301 /old/old.htm <newlink>

but yea, that's a 10-15 seconds of google question.. i would have posted the link but I can't :)
 
Found this also. Says to put in the themes 404.php file. If there is not one, create the 404.php within the theme directory

Code:
//Simple Redirect for WordPress.
 //Christopher Carey
 //301 Redirect for WordPress
 
 header("HTTP/1.1 301 Moved Permanently");
 header("Location: ".get_bloginfo('url'));
 exit();
 
add a line(s) to the .htaccess on the root of the domain

redirect 301 /expired link/ http://www.domainDOT.whatever
 
If your using wordpress I use a plugin called "404 to start".

Hope this helps
 
Thanks. I think I found what my original problem was though, I didn't add a page, so I was getting a 404 error, so it was looping.
 
That's the one I always use.
I don't know what the problem was, but it seems to be working now.
 
Back
Top