Redirects

Send old URLs to new ones with 301 or 302 rules.

This is the guide the PageHub MCP server gives an AI agent for get_style_reference({ topic: "redirects" }). Names like set_theme are its tools (connect one), and the liquid topic is the HTML + Liquid reference.

set_redirects({ redirects: [{ from: "/old-page", to: "/new-page" }, { from: "/sale", to: "https://example.com/sale", permanent: false }] }) REPLACES the whole list, so pass every rule you want to keep (read the current ones first). They run on the server before any page renders.

  • from is a site path; to is a path or a full URL. permanent is true (301) unless you pass false (302). Up to 500 rules.
  • Exact path match only: no wildcards or patterns (add a rule per URL), a trailing slash is ignored, the first matching rule wins. A redirect only applies once it is published.
  • Use it when a page's slug changes (update_page name changes the URL), a page is deleted, or a client's old site is replaced. Don't build a redirect out of a page file.