This tool generates ready-to-paste redirect rules for both Apache (.htaccess) and Nginx from a source path and a destination, with a choice of 301 (permanent) or 302 (temporary). Everything is generated locally.
How to use it
- Enter the source path or URL.
- Enter the destination URL.
- Choose 301 (permanent) or 302 (temporary).
- Copy the rule for Apache or Nginx.
About Redirect Rule Generator
Redirects keep links working and preserve SEO when URLs change. But the syntax differs between servers, and a wrong rule can cause loops or lost ranking. Apache uses Redirect or RewriteRule in .htaccess; Nginx uses return or rewrite in a server block. This generator produces both forms correctly for the redirect type you pick, so you can move a page or restructure a site without hunting through documentation. The rules are generated in your browser.
FAQ
When should I use 301 vs 302?
Use 301 (permanent) when a URL has moved for good — it passes SEO value. Use 302 (temporary) for short-term redirects you intend to reverse.
Will this preserve query strings?
The basic rules redirect the path. Preserving or rewriting query strings may need additional directives depending on your needs.
What is the difference between a 301 and a 302 redirect?
A 301 is a permanent redirect and passes SEO value to the new URL, so use it when a page has moved for good. A 302 is temporary and tells search engines the original URL will return, so it does not pass ranking the same way.