Build .htaccess 301/302 redirect rules.
This generator writes Apache .htaccess redirect rules for seven common jobs: a single 301 or 302 redirect, forcing HTTPS, adding or removing www, and adding or removing a trailing slash. The 301 and 302 options produce a one line Redirect directive from mod_alias. The other five produce a small mod_rewrite block that starts with RewriteEngine On and sends a 301. The tool does not test anything against your server; it prints text for you to paste.
A Redirect line matches the old path as a prefix, on whole path segments. Redirect 301 /blog /news also sends /blog/post-1 to /news/post-1, and query strings carry over. That is often what you want in a migration, but not if you meant one page only. The old path is case sensitive and must not include the domain; a full URL there will never match.
The Force WWW and Remove WWW rules always redirect to https://, so use them only on a site that already has a working certificate. If you stack either of them with Force HTTPS, put the www rule first; in the other order, a visit to http://example.com can take two hops. Apache also does not promise to run mod_alias and mod_rewrite lines in the order they appear, so test when you mix them. A syntax error in .htaccess usually returns a 500 error for every URL the file covers, and Nginx ignores .htaccess entirely.