w3id.org icon indicating copy to clipboard operation
w3id.org copied to clipboard

is URL rewriting with content negotiation supported?

Open nandana opened this issue 10 years ago • 5 comments

I wanted to ask whether w3id supports/permits to do URL rewriting with conditions for content negotiation, for instance using RewriteCond.

My usecase is to host my ontology in Github pages and use w3id URL as a permanent identifier. Further, I want to have content negotiation on that URL but unfortunately Github pages doesn't support content negotiation. However, if I can do this at the URL rewrite stage I can still properly do what I wanted to do.

For example, something like the following.

RewriteCond %{HTTP:Accept} text/turtle RewriteRule ^foo$ http://proj.github.io/vocab/foo.ttl [R=303,L]

RewriteCond %{HTTP:Accept} application/rdf+xml RewriteRule ^foo$ http://proj.github.io/vocab/foo.xml [R=303,L]

RewriteRule ^foo$ http://proj.github.io/vocab/foo.html [R=303,L]

P.S. I am not an expert on HTTPD config, so there may be a better way to do this.

nandana avatar Feb 24 '15 17:02 nandana

Hi Nandana,

Yes, I don’t see any reason this wouldn’t work unless the Apache wasn’t compiled with RewriteCond support. Try it :)

Regards,

Dave

http://about.me/david_wood

On Feb 24, 2015, at 12:15, Nandana Mihindukulasooriya [email protected] wrote:

I wanted to ask whether w3id supports/permits to do URL rewriting with conditions for content negotiation, for instance using RewriteCond http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritecond.

My usecase is to host my ontology in Github pages and use w3id URL as a permanent identifier. Further, I want to have content negotiation on that URL but unfortunately Github pages doesn't support content negotiation. However, if I can do this at the URL rewrite stage I can still properly do what I wanted to do.

For example, something like the following.

RewriteCond %{HTTP:Accept} text/turtle RewriteRule ^foo$ http://proj.github.io/vocab/foo.ttl http://proj.github.io/vocab/foo.ttl [R=303,L]

RewriteCond %{HTTP:Accept} application/rdf+xml RewriteRule ^foo$ http://proj.github.io/vocab/foo.xml http://proj.github.io/vocab/foo.xml [R=303,L]

RewriteRule ^foo$ http://proj.github.io/vocab/foo.html http://proj.github.io/vocab/foo.html [R=303,L]

P.S. I am not an expert on HTTPD config, so there may be a better way to do this.

— Reply to this email directly or view it on GitHub https://github.com/perma-id/w3id.org/issues/65.

prototypo avatar Feb 24 '15 17:02 prototypo

Your best bet is to set up a local server to test out configs. Another project has some content negotiation support that might be useful though I've never tried it. If you do come up with a good solution let us know and maybe we can start some docs.

https://github.com/perma-id/w3id.org/blob/master/isa/.htaccess

davidlehn avatar Feb 24 '15 17:02 davidlehn

Hi David,

On Feb 24, 2015, at 13:00, David I. Lehn [email protected] wrote:

Your best bet is to set up a local server to test out configs. Another project has some content negotiation support that might be useful though I've never tried it. If you do come up with a good solution let us know and maybe we can start some docs.

That wouldn’t answer the question of whether RewriteCond support is compiled into the w3id.org http://w3id.org/ Apache.

Regards,

Dave

http://about.me/david_wood

perma-id avatar Feb 24 '15 18:02 perma-id

mod_rewrite is enabled, it's used by almost every .htaccess file on the site. If there is something missing that's needed, we can enable it.

davidlehn avatar Feb 24 '15 18:02 davidlehn

Thanks a lot Dave and David! I will do a pull request to try it out.

nandana avatar Feb 24 '15 18:02 nandana