It looks like you should be able to use htaccess' RedirectMatch directive
(/syshelp/htaccess.htm) to handle 301 (Moved Permanently), 302 (Moved
Temorarily), and 410 (Gone).


RedirectMatch [permanent | temp | gone] <regex-match> <url>

Redirect all requests that match the regular-expression (<regex-match>) to
the URL specified. For example:
RedirectMatch permanent (.*)\.gif$ /moved.html
RedirectMatch permanent (.*)\.exe$ http://www.microsoft.com/ 


The following line in a .htaccess file in /movies would redirect the request
to another URL

        RedirectMatch gone /movies/test.mpg$ http://www.google.com/

However, I tested this and regardless of setting the RedirectMatch to
permanent, temp, or gone, the HTTP responses all produced the same results -
a 302.

----------

HTTP/1.1 302 Found
Date: Wed, 03 Dec 2003 21:16:44 GMT
Server: SAMBAR
Connection: close
Content-length: 19
Content-type: text/html
Location: http://www.google.com/

Request redirected.<HTML>
<HEAD>
<TITLE>Moved</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" LINK=#990033 VLINK=#990033 ALINK=#990033>
<TABLE BORDER=0 WIDTH=500 CELLPADDING=10 CELLSPACING=10>
<TR><TD BGCOLOR=#990033 ALIGN=LEFT>
<FONT SIZE=5 COLOR=#FFFFFF><B>Page Moved</B></FONT>
</TR></TD>
<TR><TD>
<BR>
The page requested has been moved.  You might wish to
connect to the <A HREF="/">home page</A> of this server.
</TD></TR>
<TR><TD>
<BR>
<A HREF="http://www.sambar.com";><FONT SIZE=2>Powered by Sambar</FONT></A>
</TD></TR>
</TABLE>
</BODY>
</HTML>

----------

-Jeff

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Richard Klein
Sent: Wednesday, December 03, 2003 12:45 PM
To: sambar List Member
Subject: [sambar] How to return 410 error?

My server gets a lot of requests for a movie that I deleted well over a 
year ago.  I just noticed that the HTTP spec includes a "Gone" status 
code: 410.  I used the mappings to redirect requests for the movie to an 
error page.

Here's a link for the movie: http://rich.richardklein.org/movies/test.mpg
and here's the mapping I used for it:
[aliases]
/movies/test.mpg = ../messages/gone.htm

My main problem is that the surfer's browser gets the error page, but 
gets a 200 status code instead of a 410:
"GET /movies/test.mpg HTTP/1.1" 200 375 0 "-" "Mozilla/5.0 (Windows; U; 
Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7"
So how do I get Sambar to send a 410 status code?

Also, is it okay to use the parent directory characters (../) in the 
mapping above?  It seems to work, but I'm concerned that bumping the 
surfer up out of the docs directory could introduce a security weakness.

Thanks!
        -Rich

-------------------------------------------------------
To unsubscribe please go to http://www.sambar.ch/list/



Reply via email to