htaccess Redirect Generator
Generate Apache .htaccess 301 and 302 redirect rules from old paths to new URLs. Fast, private, copy and paste.
Independently verified for accuracy
Calculator by Toolsloft ↗Generate Apache redirect rules for an .htaccess file so old URLs point to their new locations. Add each old path and its destination, pick a permanent 301 or temporary 302 redirect, and copy the rules into the .htaccess at your site root. Blank rows are ignored.
How this is calculated
Each row becomes a mod_alias directive in the form "Redirect <code> <old-path> <new-url>", the standard Apache syntax for path-based redirects. The status code is 301 for a permanent move or 302 for a temporary one, and anything other than 302 falls back to 301.
How to use
- Enter each old path and the full URL it should redirect to.
- Choose a permanent 301 or temporary 302 redirect.
- Copy the rules into the .htaccess file at your site root.
Examples
- Permanent:
/old-page to a new URL becomes Redirect 301 /old-page https://… - Temporary:
choosing 302 emits Redirect 302 for a short-term move
FAQ
- When should I use 301 versus 302?
- Use 301 for a permanent move so search engines pass ranking to the new URL. Use 302 for a temporary change you plan to reverse.
- Where does this go?
- These directives belong in the .htaccess file at your site root, and they only work on Apache servers with mod_alias enabled.
- Should the source be a path or a full URL?
- The source is a path that starts with a slash, such as /old-page. The destination is the full URL you want visitors sent to.