Redirect tools

Read your project's redirect rules or replace the complete list.

On this page

Note

The connection covers the Space. You are a member, and the Space is not locked. A Space is a shared workspace in the app.

hosting_list_redirects can be called with any role, including Read-only. For hosting_set_redirects you need Owner, Administrator or User.

hosting_list_redirects List redirects

reads only

Lists a project's redirect rules in order. The first matching rule wins.

Parameters of hosting_list_redirects
ParameterTypeRequirementDescription
spaceIntegerrequiredThe ten-digit Space ID.
projectIntegerrequiredThe project number shown by hosting_list_projects.

hosting_set_redirects Set redirects

changes datadeletes, overwrites or changes what visitors see

First use hosting_list_redirects to read the existing rules, and send every rule you want to retain with the new list.

Warning

Missing rules are removed; an empty list removes all. The tool acts on the first call without a confirmation sentence.

  • A project has at most 200 rules. A rule's source can have up to 500 characters, its destination up to 1,000. If a rule is invalid or the list is too long, TEISENDA does not save the list.
  • Two paths cannot be sources, including everything below them: /.teisenda and /.well-known/acme-challenge. They belong to the hosting node.
Parameters of hosting_set_redirects
ParameterTypeRequirementDescription
spaceIntegerrequiredThe ten-digit Space ID.
projectIntegerrequiredThe project number shown by hosting_list_projects.
rulesList of objectsrequiredThe complete list, at most 200 rules; an empty list removes every rule. Each rule is an object with source, target and optionally status. source is the source: a path starting with /. Within it, :name matches one path segment, and * at the end matches the remainder. target is the destination: a path or a full address with https. :name and * from the source can be reused in the destination. status is 301, 302, 307 or 308; if omitted, 301 applies.

If something goes wrong

Where a solution names a tool, ask the application to call it.

The list was not saved:

Only hosting_set_redirects returns this message. TEISENDA did not save the list; the message is followed by a line “Rule …: …” for each invalid rule, with its position and the reason. Correct the listed rules and call the tool again with the entire list. Each line gives one of these reasons:

  • The source is malformed or exceeds 500 characters: The source must be a path that starts with / – with no spaces, ? or #. :name fills a whole segment; /* only goes at the end.
  • The destination is malformed or exceeds 1,000 characters: The target must be a path that starts with /, or a full address starting with https://.
  • The source is a reserved path, namely /.teisenda, /.well-known/acme-challenge or anything below it: This path is reserved.
  • The destination names an unknown placeholder: The target uses a placeholder that doesn't appear in the source.
  • The status is not 301, 302, 307 or 308: Only 301, 302, 307 and 308 are allowed.
  • The rule points to itself or forms a loop: This rule points to itself or loops back through other rules.
  • The list has more than 200 rules: “More than … rules are not possible.”

Messages about the Space and project number are listed with the tools for Spaces and projects. All other messages that can occur with any tool are listed under Troubleshoot the Connector.

Next steps