ErrorDocument 404

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lauthiamkok
Forum Contributor
Posts: 153
Joined: Wed Apr 01, 2009 2:23 pm
Location: Plymouth, United Kingdom

ErrorDocument 404

Post by lauthiamkok »

Hi,
I want to redirect visitors to custom 404 error page, for example, I move my website content around but wish to redirect traffic to the new page from the old location.

I made this line in my .htaccess file,

Code: Select all

ErrorDocument 404 http://www.lauthiamkok.net/404error
it seems to be working fine. But I want to know if I am doing it correctly if you can advise me please.

do i have any down side with this line for search engines?

I came across this tutorial online, but I dont quite get it about sending 301 (permanently moved) headers....

http://bobpeers.com/technical/404_redirection.php

many thanks,
Lau
User avatar
Zlobcho
Forum Newbie
Posts: 18
Joined: Sun Jun 21, 2009 7:57 pm

Re: ErrorDocument 404

Post by Zlobcho »

I will try to explain it to you.

If you had a page with this address: http://mysite.com/index/articles/my_first_time and now your new urls are as follow: http://mysite.com/articles/my_first_time with your current approach, when I try to visit the old url I will be redirected to your 404 page but if instead redirect me from http://mysite.com/index/articles/my_first_time to http://mysite.com/articles/my_first_time with HTTP Status 301 Permanent redirect and if I was google bot for example, I would understand that this article was moved from old url to the new one and update my records but if you keep the 404 page and instead of 301 you do 404 HTTP Status I will understand it as this article does not exists anymore.

I am afraid I didn't explain it very well. When you are moving pages from one url to another its always better to use 301 redirects from the old url to the new one and keep 404 for pages that do not exists only.

:)
lauthiamkok
Forum Contributor
Posts: 153
Joined: Wed Apr 01, 2009 2:23 pm
Location: Plymouth, United Kingdom

Re: ErrorDocument 404

Post by lauthiamkok »

hey thanks for trying to explain this to me. I can follow. thanks!
Zlobcho wrote:When you are moving pages from one url to another its always better to use 301 redirects from the old url to the new one and keep 404 for pages that do not exists only.
this is the obvious difference of 404 and 301 which I will bear in mind. thanks for pointing it out! :D
Post Reply