LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-03-2008, 08:05 AM   #1
cooljai
Member
 
Registered: May 2007
Location: /dev/random
Distribution: CentOS, Fedora, RHEL, SuSE
Posts: 62

Rep: Reputation: 15
Question Apache redirect for non existing page


dear members,

I want a rewrite rule to achieve something like this:

At present, when user writes http://www.example.com/tags/car.html the car.html page open and if the car.html is not there, our site's 404 error page is displayed to indicate that car.html is not there.

I want to redirect to /tags when a page below it not exist instead of displaying 404 page.

So,

http://www.example.com/tags/car.html if not found, open http://www.example.com/tags


Thanks
 
Old 11-03-2008, 09:00 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You can use the ErrorDocument directive to do what you want. If your index page is, for example, index.htm and the path to the directory you want to control is /path/to/docroot/tags
Code:
<Directory /path/to/docroot/tags>
...
ErrorDocument 404 /tags/index.htm
</Directory>

Last edited by bathory; 11-03-2008 at 11:50 PM.
 
  


Reply

Tags
apache, redirect



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
Squid Redirect to welcome page on first internet access omid1979 Linux - Networking 3 10-15-2009 02:48 AM
Redirect page koscek Programming 9 11-02-2007 03:29 AM
Apache default page redirect Harry Seldon Linux - Enterprise 7 05-12-2006 08:50 AM
page redirect after selecting option in html juanbobo Programming 1 05-13-2005 07:05 AM
how to redirect PHP code to another page bahadur Programming 3 03-21-2005 05:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:14 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
Open Source Consulting | Domain Registration