Created
September 25, 2008 10:34
-
-
Save FabienGandon/12799 to your computer and use it in GitHub Desktop.
content negotiation in .htaccess to serve an RDF voc as HTML or rdf+xml depending on the client request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Turn off MultiViews | |
Options -MultiViews | |
# Directive to ensure *.rdf files served as appropriate content type, | |
# if not present in main apache config | |
AddType application/rdf+xml .rdf | |
# Rewrite engine setup | |
RewriteEngine On | |
RewriteBase /irc/2008/09/25 | |
# Rewrite rule to serve HTML content from the vocabulary URI if requested | |
RewriteCond %{HTTP_ACCEPT} !application/rdf\+xml.*(text/html|application/xhtml\+xml) | |
RewriteCond %{HTTP_ACCEPT} text/html [OR] | |
RewriteCond %{HTTP_ACCEPT} application/xhtml\+xml [OR] | |
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/.* | |
RewriteRule ^voc$ voc.html [R=303] | |
# Rewrite rule to serve RDF/XML content from the vocabulary URI if requested | |
RewriteCond %{HTTP_ACCEPT} application/rdf\+xml | |
RewriteRule ^voc$ voc.rdf [R=303] | |
# Default response : Rewrite rule to serve the RDF/XML content from the vocabulary URI by default | |
RewriteRule ^voc$ voc.rdf [R=303] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment