I can't find what piece of htaccess code I need to put on an htaccess to have my 404 errors redirect to another url automatically. Anyone got it handy?
I can't find what piece of htaccess code I need to put on an htaccess to have my 404 errors redirect to another url automatically. Anyone got it handy?
Redirect /error_pages/404.html / http://www.yourdomain.com/new_dir/index.html
Hope that helps.
ErrorDocument 404 /directory/filename.ext
you might want to automatically send them back to your home page so you could do something like this (change .PHP to .HTM, .HTML, or whatever is your default extension):
ErrorDocument 404 /index.php
Kevin
Now I found the link I was looking for:
http://www.htaccess-guide.com/
There you will find all about .htaccess
That's actually kind of a double-redirect. Somewhere in .htaccess or elsewhere in the Apache configuration, there has to be an order to send 404 errors to "/error_pages/404.html" or else the browser will simply display it's default 404 Page Not Found message because it has no instructions from Apache to look for an error page. But assuming that the redirect order does exist, it sends it to "/error_pages/404.html" but before it even arrives there Apache will send it off again to "http://www.yourdomain.com/new_dir/index.html". So it ends up being redirected twice.
Using ErrorDocument ### (for 404 or any other numeric error code) should be used to send the user where you want him/her to go. If it's a custom error page saying "Sorry, can't find that, please click here to go to our home page" or if you want to send them directly to the home page without notice, you can code it either way.
Generally it's best to use relative URLs in these cases, in case you ever move your site to another domain. So /mycustomerrorpage.htm is better than http://mydomain.com/mycustomerrorpage.htm.
Be very cautious about using ErrorDocument rules with Apache rewrite or redirect rules in .htaccess. If you don't know what you're doing, you can end up in an endless loop where Apache sends the user to an error page which has its URL rewritten to a non-existent page (error) which sends the user to an error page .... you get the idea.
Kevin
Ok Kevin, I get it. Thanks for making things more clear.
Btw, I use custom 404 pages with revshare links.
Also a nice idea is to give the visitor the choice where to go in a given time and redirect the page to where you like in this given time. But sure, it depends all of your reasons and plans what and how to do. $0.02
So Bec, I hope you will find the right solution.
Thanks guys for such informative answers! You rock!
Lippi, do I just use my embedded code link as the forward to url to get credit on a redirect? Been meaning to ask if that's doable and if you still get credit for any sales by doing that.
I guess it's doable, Bec. But be careful, I guess some programs doesn't allow promoting with redirects. Check their terms first.
I don't use redirects with my 404 page. I put some links on it, only.
Just check it out here: www.thebestboys.com/kedkeh/
It's a good idea to send it to your preview site. I guess this will work fine. Good luck with this!
Bookmarks