About Redirect Rule Generator
Moving a site or renaming pages means telling the server where every old address now lives. Paste your list, one redirect per line with the old path first and the new path or full URL second, and get rules ready to paste into an .htaccess file, an Nginx server block, a Netlify _redirects file or vercel.json.
Each rule matches its old path exactly, so /blog does not also catch /blog/archive. Old URLs with a query string, such as /page.php?id=7, are matched on that query string too where the server allows it. Mistakes that would break a site, such as a URL sent to itself or the same old URL listed twice, are reported with their line number.
How it works
- Each line is split into an old and a new URL at spaces, a tab, a comma or an arrow. A full URL on the old site is reduced to its path and query string. Blank lines and lines starting with # are skipped.
- Apache rules use mod_rewrite with an exact pattern, so special characters in the path are escaped and an old query string is checked with RewriteCond. Nginx rules use exact-match locations, or a test of $request_uri when a query string must match.
- Netlify gets one line per redirect in _redirects format, and Vercel a redirects list for vercel.json, with query strings matched through has conditions.
- On Apache and Nginx the visitor’s query string is passed on, unless the old URL matched one or the new URL has its own.
Questions
Which status code should I use?
Use 301 when a page has moved for good: search engines then transfer it to the new address. Use 302 or 307 for a temporary move. 307 and 308 are the newer codes that also keep a form submission’s method.
Where do the Nginx rules go?
Inside the server { } block of your site’s configuration, before any broader location blocks. Test the configuration with nginx -t and reload Nginx afterwards.
Why are some Netlify rules written as comments?
Netlify’s _redirects file matches query parameters by name, not by exact value, so a redirect for one particular query string cannot be expressed reliably. Those lines are listed as comments for you to handle another way.
How many redirects can I convert at once?
Up to 5,000 lines, within 1 MB of text. Very long redirect lists slow some servers down; for tens of thousands, a lookup map on the server is a better fit.
Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.