LinuxQuestions.org
Visit the LQ Articles and Editorials section
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, 09: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, 10:00 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
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-04-2008 at 12:50 AM.
 
  


Reply

Tags
apache, redirect


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


All times are GMT -5. The time now is 08:20 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