Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 07-23-2009, 01:18 PM   #1
Jorkim Kustafin
LQ Newbie
Registered: Jul 2009
Posts: 5

Rep: Reputation: 0
Apache htaccess redirect

Hallo, i found an old threed in this forum, when searching for a problem on google.

I want to give a 404 error when the index.html file is requested, i already know how to do this in php, but i cant seem to locate any information about how to do it in htaccess.

I thought about just redirecting index.html to a page that dose not exist, but i would like to do it correctly from the start.
Old 07-23-2009, 01:27 PM   #2
LQ 5k Club
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You could try
Redirect /index.html /error.html
Old 07-23-2009, 01:32 PM   #3
Jorkim Kustafin
LQ Newbie
Registered: Jul 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I know, but thats not a "true" 404 is it? Im thinking about using mod_rewrite, to simply make index.html refer to the error document, and then throw out the appropriate headers from within the error document. Similar to whats done in

My guess is that the correct way to do it would be similar to below?

RewriteEngine on
RewriteRule ^index.html$ /404.php

Last edited by Jorkim Kustafin; 07-23-2009 at 01:34 PM.



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
Apache2 .htaccess redirect problem raven Linux - Networking 0 08-06-2007 03:35 AM
.htaccess - whats wrong with this redirect syntax? neocontrol Linux - Server 3 03-16-2007 03:55 PM
Apache redirect with query string (.htaccess) penguintutor Linux - Server 2 09-20-2006 10:45 AM
htaccess 'redirect permanent' failing mikeindo Linux - Networking 0 07-07-2005 02:05 AM
Htaccess with a redirect Diode Linux - Networking 0 10-28-2003 07:23 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:23 AM.

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
Open Source Consulting | Domain Registration