Set up redirects for dereferencing

An IRI such as https://example.org/resource/Amsterdam should lead to a description of Amsterdam when someone opens it. When that description lives in a TriplyDB dataset — here https://api.triplydb.com/MyAccount/myCities — a redirect sends the visitor from the IRI to the dataset. It takes two parts: the web server of example.org forwards the request to TriplyDB, and a rule in TriplyDB decides which dataset receives it. The second part needs administrator privileges.

Forward the IRIs to TriplyDB

On the web server that the IRIs point at, redirect every path to be dereferenced to TriplyDB's redirect endpoint, with the full requested IRI appended:

https://api.triplydb.com/redirect/$requestUri

For the example, redirect every subpath of https://example.org/resource/, so that a request for https://example.org/resource/Amsterdam is sent on to https://api.triplydb.com/redirect/https://example.org/resource/Amsterdam. How to write that redirect depends on the web server.

Add a redirect rule

  1. Open the admin settings, then Redirects under General.
  2. Click Add rule, in the top-right corner.
  3. Choose the rule type: Prefix matches IRIs that start with a string, Regex matches IRIs against a regular expression. For the example, choose Prefix with the pattern https://example.org/resource/.
  4. Choose the dataset to redirect to: MyAccount/myCities.
  5. Click Create.

Rules are tried from top to bottom and the first match wins, so place a narrower rule above a broader one. Open https://example.org/resource/Amsterdam to check that it now lands on the dataset. The Redirects page reference describes the rule types.