Forum Moderators: phranque

Message Too Old, No Replies

.htaccess redirect all file requests

         

firstfoot

4:56 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



I have a subdomain on my site that ran my OSCommerce shop. I've closed the shop down but don't want folk to suffer from 404's.

I've been trying lots of redirect commands in .htaccess but cannot get it to work.

Suggestions REALLY appreciated.

lammert

6:54 pm on Jan 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You could create a nice message file called sorry.html with some descriptive content and add the following line to your .htaccess file on the subdomain:

ErrorDocument 404 /sorry.html

This will redirect all 404 requests to your own sorry.html. I have used this method with quite some success serving a copy of the sitemap of the main site as sorry.html.

Be sure to add the following line to the head section of the sorry.html file to prevent several copies of the file to be indexed in the search engines causing possible duplicate content penalties.

<meta name="robots" content="noindex,follow">

firstfoot

8:08 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



I tried you suggestion and it still gives 404's

Ideas?

jdMorgan

8:55 pm on Jan 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you flush your browser cache before testing?

Jim

firstfoot

9:09 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



Yes, cache all flushed .... and still 404'2 :-(

lammert

9:17 pm on Jan 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How large is the response text/file you send with your 404? I remember having read that browsers display their own 404 message if the 404 text returned by the server is less than 256 or 512 bytes.

Some webhosting companies don't allow the use of .htaccess files. Others check for the existence of an .htaccess file every hour or so. This could be the case.

<added>
I have found the source which explains that internet explorer will display its internal error messages instead of the server generated message when the response message from the server is less than 512 bytes. It is knowledge base article Q218155 [support.microsoft.com] at the microsoft support website.
</added>

firstfoot

9:36 pm on Jan 19, 2006 (gmt 0)

10+ Year Member



The file is 1.15kb

The host allows .htaccess ... I have .htaccess working perectly on other directories .... but not on a subdomain.