W3C home > Mailing lists > Public > public-esw-thes@w3.org > October 2005

[VM] content-dependent redirects in apache ... help!

From: Miles, AJ \(Alistair\) <A.J.Miles@rl.ac.uk>
Date: Mon, 3 Oct 2005 16:20:16 +0100
Message-ID: <677CE4DD24B12C4B9FA138534E29FB1D0ACD89@exchange11.fed.cclrc.ac.uk>
To: <semantic-web@w3.org>, <public-esw-thes@w3.org>, <public-swbp-wg@w3.org>

Hi all,

A short while ago I posted a proposed URI dereferencing policy & setup for SKOS Core [1] as a possible candidate for future best practice wrt 'hash' RDF namespaces.  To sum up what it does: basically, if the client asks for html, it gets redirect to the latest version of the html documentation, and if the client asks for rdf, it gets redirected to the latest version of the rdf description.  This was to satisfy two requirements:

(Requirement 1) property & class URIs are 'clickable' in web browsers and take you to human readable stuff.

(Requirement 2) provenance of any rdf statements about classes/props is always a date-stamped version of the 'ontology', allowing determination of which 'version' is being used by an application at run-time.

I've tried to implement this setup as a test on the W3C server, but have run into a problem and so am posting this in the hope that those who know apache better than me can tell me what's going on (i.e. help! :)

I've got the following setup:

In the directory /2004/02/skos/ there is a file 'bar.var' which looks like ...
---
URI: bar

URI: core-latest-rdf
Content-type: application/rdf+xml

URI: core-latest-html
Content-type: text/html

URI: core-latest-html
Content-type: text/xml

URI: core-latest-html
Content-type: application/xml

URI: core-latest-html
Content-type: application/xhtml+xml
---

I added the following lines to .htaccess in /2004/02/skos/ ...
---
RewriteRule ^core-latest-rdf$ /2004/02/skos/core/history/2005-03-31 [R=303]
RewriteRule ^core-latest-html$ /TR/2005/WD-swbp-skos-core-spec-20050510 [R=303]
---

(So the idea was to test if I could make the URI http://www.w3.org/2004/02/skos/bar behave how we ultimately want the URI http://www.w3.org/2004/02/skos/core to behave).

Now, if I try to GET http://www.w3.org/2004/02/skos/bar.var everything behaves as I would like, with a redirect to different resources dependent on the 'Accept:' header in the original request.

However, if I try to GET http://www.w3.org/2004/02/skos/bar I get a 404 not found.  It's obviously getting to the type-map file, because of the header returned by the server (see below, the 'Content-Location:' field), but for some reason is not doing the subsequent redirect.

Here's the HTTP trace, anyone know what's going on? ...
---
http://www.w3.org/2004/02/skos/bar

GET /2004/02/skos/bar HTTP/1.1
Host: www.w3.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive

HTTP/1.x 404 Not Found
Date: Mon, 03 Oct 2005 15:10:16 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10
Content-Location: core-latest-html
Vary: negotiate,accept
TCN: choice
P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
Last-Modified: Mon, 05 Sep 2005 07:47:53 GMT
Etag: "431bf829;43414560"
Accept-Ranges: bytes
Content-Length: 2006
Content-Type: text/html; charset=iso-8859-1
X-Cache: MISS from wwwcache.rl.ac.uk
Proxy-Connection: close
----------------------------------------------------------
http://www.w3.org/2004/02/skos/bar

GET /2004/02/skos/bar HTTP/1.1
Host: www.w3.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728
Accept: application/rdf+xml
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive

HTTP/1.x 404 Not Found
Date: Mon, 03 Oct 2005 15:15:13 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10
Content-Location: core-latest-rdf
Vary: negotiate,accept
TCN: choice
P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
Last-Modified: Mon, 05 Sep 2005 07:47:53 GMT
Etag: "431bf829;43414560"
Accept-Ranges: bytes
Content-Length: 2006
Content-Type: text/html; charset=iso-8859-1
X-Cache: MISS from wwwcache.rl.ac.uk
Proxy-Connection: close
----------------------------------------------------------
http://www.w3.org/2004/02/skos/bar.var

GET /2004/02/skos/bar.var HTTP/1.1
Host: www.w3.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive

HTTP/1.x 303 See Other
Date: Mon, 03 Oct 2005 15:15:50 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10
Content-Location: core-latest-html
Vary: negotiate,accept
TCN: choice
Location: http://www.w3.org/TR/2005/WD-swbp-skos-core-spec-20050510
Content-Type: text/html; charset=iso-8859-1
X-Cache: MISS from wwwcache.rl.ac.uk
Proxy-Connection: close
----------------------------------------------------------
http://www.w3.org/2004/02/skos/bar.var

GET /2004/02/skos/bar.var HTTP/1.1
Host: www.w3.org
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728
Accept: application/rdf+xml
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive

HTTP/1.x 303 See Other
Date: Mon, 03 Oct 2005 15:15:43 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10
Content-Location: core-latest-rdf
Vary: negotiate,accept
TCN: choice
Location: http://www.w3.org/2004/02/skos/core/history/2005-03-31
Content-Type: text/html; charset=iso-8859-1
X-Cache: MISS from wwwcache.rl.ac.uk
Proxy-Connection: close
---

Cheers,

Al.

[1] http://lists.w3.org/Archives/Public/public-esw-thes/2005Sep/0008.html

---
Alistair Miles
Research Associate
CCLRC - Rutherford Appleton Laboratory
Building R1 Room 1.60
Fermi Avenue
Chilton
Didcot
Oxfordshire OX11 0QX
United Kingdom
Email:        a.j.miles@rl.ac.uk
Tel: +44 (0)1235 445440
Received on Monday, 3 October 2005 15:20:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 7 December 2009 10:38:54 GMT