{"_id":"58112e72ded0340f0085d058","parentDoc":null,"project":"551e85be610f400d00837db7","category":{"_id":"58112e72ded0340f0085d033","project":"551e85be610f400d00837db7","version":"58112e71ded0340f0085d02a","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-25T13:57:54.835Z","from_sync":false,"order":8,"slug":"api-resources","title":"Merchant API Resources"},"version":{"_id":"58112e71ded0340f0085d02a","project":"551e85be610f400d00837db7","__v":4,"createdAt":"2016-10-26T22:30:09.862Z","releaseDate":"2016-10-26T22:30:09.862Z","categories":["58112e72ded0340f0085d02b","58112e72ded0340f0085d02c","58112e72ded0340f0085d02d","58112e72ded0340f0085d02e","58112e72ded0340f0085d02f","58112e72ded0340f0085d030","58112e72ded0340f0085d031","58112e72ded0340f0085d032","58112e72ded0340f0085d033","58112e72ded0340f0085d034","581137cc604d3c230048b7e4","58dc367221742d0f00a73f98","590768e54669da0f00db5c0b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"new designer","version_clean":"2.0.0","version":"2.0"},"user":"55253acaf0f4610d00f7193f","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-21T03:46:54.957Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"[block:html]\n{\n  \"html\": \"<div class=\\\"endpoint\\\">\\n  http://api.cratejoy.com/v1/page_redirects/\\n</div>\\n\\n<style>\\n.endpoint{\\n  font-family: Monaco, Menlo, Consolas, \\\"Courier New\\\", monospace;\\n  font-size: 14px;\\n  background-color: #f9f9f9;\\n  padding: 5px 15px;\\n</style>\"\n}\n[/block]\n## Page Redirect Definition\n\n* `path` (string): The path of the URL on your store to redirect from. This value should start with a slash, e.g.: `/about/about-us.php`. \n  * Requests to the `path` route on your storefront will only be redirected when the route doesn't exist in your theme code (and would 404 without an enabled redirect).\n* `target` (string): The URL to send redirects to, e.g. `https://old-domain.com/about_us.php`\n* `code` (integer): Status code to use for the redirect, i.e. use 301 for permanents or 302 for temporary redirects.\n* `enabled` (boolean): Enable or disable the redirect.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"A page direct from a working URL will be ignored. They'll only apply on pages that would otherwise be a 404.\"\n}\n[/block]\n## Basic Usage\n\nA redirect with the following attributes will forward requests to `https://potatostore.cratejoy.com/blog/about-us.html` to `https://google.com` with status code 302.\n \n* `path`: `/blog/about-us.html`\n* `target`: `https://google.com`\n* `enabled`: True\n* `code`: 302\n\n\n## Advanced Usage\n\nYou can also specify generic redirects. Generic redirects are templates that map paths on your store to targets on another domain based on a pattern. Here's an example:\n\n* `path`: `/blog/(.*).html`\n* `target`: `https://myotherdomain.com/blog/{0}.html`\n\nThis will forward any request that matches the regex specified by `path` to the `target` template. The `{0}` in the target template will be replaced with the matching text. The templating pattern is extensible to arbitrary regex patterns.\n\n* `path`: `/blog/(.+)/(.+).html`\n* `target`: `https://myotherdomain.com/{1}/blog/{0}.html`\n\nThe above pattern allows you to rearrange elements selected by the `path`, when filling them into the target template. The first element in the `path` will replace `{0}` in the target, while the second element will replace the `{1}`.","excerpt":"","slug":"page-redirect","type":"basic","title":"Page Redirect"}
[block:html] { "html": "<div class=\"endpoint\">\n http://api.cratejoy.com/v1/page_redirects/\n</div>\n\n<style>\n.endpoint{\n font-family: Monaco, Menlo, Consolas, \"Courier New\", monospace;\n font-size: 14px;\n background-color: #f9f9f9;\n padding: 5px 15px;\n</style>" } [/block] ## Page Redirect Definition * `path` (string): The path of the URL on your store to redirect from. This value should start with a slash, e.g.: `/about/about-us.php`. * Requests to the `path` route on your storefront will only be redirected when the route doesn't exist in your theme code (and would 404 without an enabled redirect). * `target` (string): The URL to send redirects to, e.g. `https://old-domain.com/about_us.php` * `code` (integer): Status code to use for the redirect, i.e. use 301 for permanents or 302 for temporary redirects. * `enabled` (boolean): Enable or disable the redirect. [block:callout] { "type": "info", "body": "A page direct from a working URL will be ignored. They'll only apply on pages that would otherwise be a 404." } [/block] ## Basic Usage A redirect with the following attributes will forward requests to `https://potatostore.cratejoy.com/blog/about-us.html` to `https://google.com` with status code 302. * `path`: `/blog/about-us.html` * `target`: `https://google.com` * `enabled`: True * `code`: 302 ## Advanced Usage You can also specify generic redirects. Generic redirects are templates that map paths on your store to targets on another domain based on a pattern. Here's an example: * `path`: `/blog/(.*).html` * `target`: `https://myotherdomain.com/blog/{0}.html` This will forward any request that matches the regex specified by `path` to the `target` template. The `{0}` in the target template will be replaced with the matching text. The templating pattern is extensible to arbitrary regex patterns. * `path`: `/blog/(.+)/(.+).html` * `target`: `https://myotherdomain.com/{1}/blog/{0}.html` The above pattern allows you to rearrange elements selected by the `path`, when filling them into the target template. The first element in the `path` will replace `{0}` in the target, while the second element will replace the `{1}`.