简体   繁体   中英

How to write a simple content negotiation with apache

I would like to write a rules that says, whenever that resource is requested, if the content type is X return the file_x, if it is Y return file_Y

Can anyone help here ?

Many thanks,

-D-

In addition to what's mentioned in your other question , another alternative is to use a type map file . For example, I used the following file type map to serve my foaf profile.

URI: card

URI: card.ttl
Content-type: text/turtle; qs=1.0

URI: card.rdf
Content-type: application/rdf+xml; qs=0.8

URI: card.html
Content-type: text/html; qs=0.8

URI: card.trix
Content-type: application/trix; qs=0.8

URI: card.trig
Content-type: application/x-trig; qs=0.8

URI: card.n3
Content-type: text/rdf+n3; qs=0.8

URI: card.nt
Content-type: text/plain; qs=0.8

and here are the files. http://people.apache.org/~nandana/id/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM