URL joiner

Resolve relative links such as ../page or ?q=1 against a base URL, following RFC 3986.

Input

The absolute URL the links are relative to.
Relative or absolute links to resolve.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/url-join \
  -H 'Content-Type: application/json' \
  -d '{"input":{"base":"http://a/b/c/d;p?q","references":["g","../g","/g","//g","?y","#s","../../../g"]}}'
import json, urllib.request

body = {'input': {'base': 'http://a/b/c/d;p?q', 'references': ['g', '../g', '/g', '//g', '?y', '#s', '../../../g']}}
request = urllib.request.Request("https://setget.net/v1/tools/url-join", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/url-join", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"base":"http://a/b/c/d;p?q","references":["g","../g","/g","//g","?y","#s","../../../g"]}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "url-join",
  "input": {
    "base": "http://a/b/c/d;p?q",
    "references": [
      "g",
      "../g",
      "/g",
      "//g",
      "?y",
      "#s",
      "../../../g"
    ]
  }
}
{
  "input": {
    "base": "http://a/b/c/d;p?q",
    "references": [
      "g",
      "../g",
      "/g",
      "//g",
      "?y",
      "#s",
      "../../../g"
    ]
  }
}

Endpoint: POST /v1/tools/url-join. Over MCP: run_tool with slug: "url-join". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
base string yes The absolute URL the links are relative to.
references array yes Relative or absolute links to resolve.

Examples

The examples from RFC 3986

Input
{
  "base": "http://a/b/c/d;p?q",
  "references": [
    "g",
    "../g",
    "/g",
    "//g",
    "?y",
    "#s",
    "../../../g"
  ]
}
Result
{
  "base": "http://a/b/c/d;p?q",
  "results": [
    {
      "reference": "g",
      "url": "http://a/b/c/g"
    },
    {
      "reference": "../g",
      "url": "http://a/b/g"
    },
    {
      "reference": "/g",
      "url": "http://a/g"
    },
    {
      "reference": "//g",
      "url": "http://g"
    },
    {
      "reference": "?y",
      "url": "http://a/b/c/d;p?y"
    },
    {
      "reference": "#s",
      "url": "http://a/b/c/d;p?q#s"
    },
    {
      "reference": "../../../g",
      "url": "http://a/g"
    }
  ]
}
Input
{
  "base": "https://example.com/docs/guide/",
  "references": [
    "intro.html",
    "../img/logo.png"
  ]
}
Result
{
  "base": "https://example.com/docs/guide/",
  "results": [
    {
      "reference": "intro.html",
      "url": "https://example.com/docs/guide/intro.html"
    },
    {
      "reference": "../img/logo.png",
      "url": "https://example.com/docs/img/logo.png"
    }
  ]
}

Questions

Why does the last part of the base disappear?
A relative link replaces everything after the last slash of the base. End the base with a slash if its last part is a folder.