{"category":"generate","endpoint":"https://setget.net/v1/tools/htaccess-redirects","examples":[{"input":{"redirects":[{"from":"/old-page","to":"/new-page"},["/blog/2019/post.html","https://blog.example.com/post"]]},"output":{"count":2,"filename":".htaccess","text":"RedirectMatch 301 ^/old-page$ /new-page\nRedirectMatch 301 ^/blog/2019/post\\.html$ https://blog.example.com/post\n"}},{"input":{"format":"nginx","redirects":"/old-page /new-page\n/sale /offers","status":302},"output":{"count":2,"filename":"redirects.conf","text":"location = /old-page { return 302 /new-page; }\nlocation = /sale { return 302 /offers; }\n"},"title":"Nginx, from plain text"},{"input":{"format":"netlify","redirects":[["/old-page","/new-page"]]},"output":{"count":1,"filename":"_redirects","text":"/old-page /new-page 301\n"},"title":"Netlify and Cloudflare Pages"}],"input_schema":{"additionalProperties":false,"properties":{"format":{"default":"apache","description":"Which server the rules are for. netlify is the _redirects format, also used by Cloudflare Pages.","enum":["apache","nginx","netlify"],"type":"string"},"redirects":{"description":"The redirects: a list of {\"from\": \"/old\", \"to\": \"/new\"} objects or [\"/old\", \"/new\"] pairs. Plain text with \"old new\" on each line also works.","examples":[[{"from":"/old-page","to":"/new-page"}]]},"status":{"default":301,"description":"301 for a permanent move (best for SEO), 302 for a temporary one.","enum":[301,302],"type":"integer"}},"required":["redirects"],"type":"object"},"keywords":["htaccess redirect generator","301 redirect","redirect rules","nginx redirect","netlify redirects","_redirects file","htaccess generator","url redirect"],"related":["robots-txt-generate","sitemap-generate"],"slug":"htaccess-redirects","summary":"Turn a list of old and new addresses into redirect rules for Apache .htaccess, Nginx, or a Netlify _redirects file.","tier":"inline","title":"Redirect rules generator","url":"https://setget.net/tools/htaccess-redirects"}
