LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices



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

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


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

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

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

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

Hey,

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:

[code]
# 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/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#
[\code]

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

Later
 
Old 04-01-2004, 11:48 AM   #3
WeNdeL
Member
 
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...

 
  


Reply


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 03:45 PM
Redirection in Apache gonzo22 Linux - Networking 5 02-12-2005 10:54 AM
Apache - Redirection problem... elitecodex Linux - Software 5 03-29-2004 11:12 PM
Redirection question... Zeracles *BSD 0 02-21-2004 12:11 PM
apache redirection failing acid_kewpie Linux - Networking 2 08-15-2002 05:29 PM


All times are GMT -5. The time now is 02:34 AM.

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