.htaccess & Nginx Redirect Generator
Create correct 301 and 302 redirect rules for Apache and Nginx, from a single moved page to a whole domain migration or a bulk list from a spreadsheet. Paths are escaped, loops and duplicates are caught.
Private by design: anything you enter is processed in your browser only. It is never uploaded to or logged on our servers. Share links contain the form values, including the bulk list.
Back up your configuration first. For Apache, put the rules near the top of .htaccess, before any CMS rewrite block (rename the download to .htaccess). For Nginx, run nginx -t before reloading. Need a full server block with HTTPS, caching or a reverse proxy? Use the Web Server Config Generator.
About server redirects
A 301 redirect tells browsers and search engines that a page has moved permanently, so links and rankings pass to the new address. Use 302 only for temporary moves such as a short promotion. Server redirects are faster and more reliable for SEO than JavaScript or meta refresh redirects.
Paths are matched exactly, with or without a trailing slash, and characters such as dots and brackets are escaped so they are not treated as regular expressions. If the old URL has a query string (for example ?id=5), only that exact query string is matched and it is removed from the new URL. The host in a full old URL is ignored: the rules apply to the site you install them on.
For a migration, export the old and new URLs from your crawler or spreadsheet and paste or load them as CSV. Every line is checked; lines with problems are listed with their line number, and the valid lines are still converted. Redirect each old page to its closest new equivalent, not everything to the home page, which Google treats as a soft 404.
Reference Guide
| Code | Meaning | When to use |
|---|---|---|
301 | Moved permanently | Changed URLs, site migrations, HTTPS and www rules. Browsers cache it. |
302 | Found (temporary) | Short-term moves, A/B tests, maintenance pages. Not cached by default. |
| Apache flag | Effect |
|---|---|
R=301 | Send an external redirect with this status. |
L | Stop processing further rules for this request. |
NE | Do not escape the target again (keeps # and %20 intact). |
QSD / QSA | Discard the visitor's query string / append it to the target's own query. |
NC | Case-insensitive match (used for host names). |
Test with curl -I https://example.com/old-page: the response should show 301 and the new Location. Browsers cache 301s, so test in a private window.
Example input
old_url,new_url,code /about-us,/about /blog/2019/seo-tips,/blog/seo-tips /product.php?id=5,/products/blue-mug /summer-sale,https://shop.example.com/sale,302
This sample loads automatically when you open the tool. Use Load Sample to bring it back.
Was this tool useful?
Thanks for your feedback!
Could not send your feedback. Please try again later.
Frequently Asked Questions
Use 301 when a page or site has moved for good: search engines move rankings and links to the new URL and browsers cache it. Use 302 only for temporary moves such as a short promotion or maintenance page.
In the .htaccess file in your site's document root, near the top and before any CMS block such as WordPress's "# BEGIN WordPress". Apache needs mod_rewrite enabled and AllowOverride set to allow .htaccess files.
Enter the old URL including the query string, for example /product.php?id=5. Apache gets a RewriteCond on the exact query string and Nginx compares $request_uri, and the old query string is removed from the new URL.
Yes. Choose "Bulk list or CSV", then paste two columns (old and new URL) or load a CSV file. An optional third column sets 301 or 302. Every line is checked for invalid URLs, duplicates and redirect loops, and problem lines are listed by line number.
Related Tools
All SEO Tools →Free SEO Analyzer & Website Audit Tool
Comprehensive SEO analysis for any website. Check technical...
Free XML Sitemap Generator
Generate XML sitemaps for your website and submit to Google...
Meta Tag Analyzer & SEO Checker
Analyze and optimize meta title, description, and Open Graph...
Text Encrypt & Decrypt (AES-256)
Encrypt text with a password using AES-256-GCM and PBKDF2, a...
CSS Custom Scrollbar Generator
Design and generate custom CSS scrollbar styles with a visua...
CSS Gradient Generator
Create beautiful linear and radial CSS gradients with a visu...