Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-01-2004, 09:49 AM   #1
Registered: Oct 2002
Location: At my desk...
Distribution: RedHat, Fedora, Ubuntu
Posts: 344

Rep: Reputation: 30
Question Apache redirection question...

If exists but doesn't, how can I make it such that when a client points there browser at, they get redirected to (or any other url for that matter).

I am basically trying to prevent someone's stale bookmarks from returning a "page not found" error.

Old 04-01-2004, 10:32 AM   #2
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Red Hat, openBSD,Mandrake,freeBSD,SunOS
Posts: 168

Rep: Reputation: 30
A couple of answers...


Sorry but I don't really have a lot of time to go into it but I hope this puts you on the right path.

In your httpd.conf file do a search for 404. They have some info there explaining what you can do with server errors:

# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/"
#ErrorDocument 402

You can set up your own page for when a person clicks on a link that doesn't work (404 errors)
Here are some of the defaults:

ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /error/404error.html
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var

I put /error/404error.html as the page that loads when someone looks for a page that doesn't exist. It doesn't have to be in the error directory you could have it go to any file under you web root.

Basically it is just a html page with a message and then times out and redirects the user to where ever you want.

you could also do internal redirects....but that is what I don't have time for. Bascially you would send the 404 errors to a sub handler, apachelib or perl file that you created that does an internal_redirect.

Hope that helped

Old 04-01-2004, 10:48 AM   #3
Registered: Oct 2002
Location: At my desk...
Distribution: RedHat, Fedora, Ubuntu
Posts: 344

Original Poster
Rep: Reputation: 30
thanks man, I will being my research on the "ErrorDocument" directive...



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache - Website Redirection Help cbarone2005 Linux - Software 2 09-29-2005 02:45 PM
Redirection in Apache gonzo22 Linux - Networking 5 02-12-2005 09:54 AM
Apache - Redirection problem... elitecodex Linux - Software 5 03-29-2004 10:12 PM
Redirection question... Zeracles *BSD 0 02-21-2004 11:11 AM
apache redirection failing acid_kewpie Linux - Networking 2 08-15-2002 04:29 PM

All times are GMT -5. The time now is 01:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration