Paste old and new URLs and get 301 rules for .htaccess or Nginx, checked for loops
Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 16 Oct 2026.A 301 redirect tells browsers and search engines that a page has moved for good. In Apache's .htaccess, RewriteRule ^old-page$ /new-page [L,R=301] sends /old-page to /new-page; in Nginx, location = /old-page { return 301 /new-page; } does the same. Use 302 or 307 for a temporary move and 410 for a page removed on purpose.
Paste one redirect per line into the Redirects box: the old path, a space, then the new path or URL.
Choose Apache or Nginx, and turn on Force HTTPS or pick www or no www if you want those too.
Fix any line marked as a loop, and accept the offer to shorten chains so each visitor makes one hop.
Click Copy or Download, and add the rules to the top of your .htaccess file or your server block.
Paste one redirect per line, the old address and then the new one, and the rules are written as you type. Old addresses can be paths or full URLs copied from a browser or an analytics export; tabs, commas and arrows also work, so a spreadsheet column pair pastes straight in. Add a code at the end of a line to override the default, or write 410 instead of a new address for a page that is gone.
Which code.
| Code | Meaning | Use it for |
|---|---|---|
| 301 | Moved permanently | Renamed pages, a new domain, HTTPS |
| 308 | Permanent, same method | APIs and forms that POST |
| 302 / 307 | Temporary | Campaigns, maintenance, A/B tests |
| 410 | Gone | Pages removed on purpose |
Apache. Every rule uses mod_rewrite. The simpler Redirect directive matches prefixes, so Redirect /shop /store also catches /shopping, and mixing the two modules runs them in an order that surprises people. Patterns are anchored and escaped, so a dot in old.html matches only a dot. An old address with a query string, such as /products?id=42, gets its own RewriteCond and the query is dropped from the new address.
Nginx. Each page gets an exact location = block with return. HTTPS and the www choice get their own server blocks, which need your domain.
Checks. A rule that sends a page to itself, directly or through other rules, is a loop and is left out. A rule that points at another redirected page is a chain; one click points it straight to the final page, so visitors and crawlers make one hop instead of several. A repeated old address is flagged, because only the first rule would ever run.
HTTPS and the host are handled in one hop, before the page rules. Test with 302 first: browsers remember a 301 for a long time.
Everything runs in your browser; nothing you paste is sent anywhere.
Add RewriteEngine On once, then one line per page: RewriteRule ^old-page$ /new-page [L,R=301]. The pattern has no leading slash in .htaccess, the caret and dollar make it match only that exact page, and R=301 makes the move permanent. Place the rules near the top of the file, before any WordPress or framework block.
301 and 308 are permanent: search engines move the old page's ranking to the new address. 302 and 307 are temporary, so the old address stays indexed. 307 and 308 also require browsers to repeat the same method, such as POST, while 301 and 302 allow a switch to GET. Most page moves should use 301.
Combine the conditions so the visitor makes a single hop: redirect when HTTPS is off or the host starts with www, and send them to https plus the host without www. This generator writes exactly that with three RewriteCond lines and one RewriteRule, or a pair of server blocks for Nginx, instead of two separate redirects in a row.
A loop happens when a rule sends a page to an address that the same or another rule redirects back. Common causes are redirecting /page to /page/ while another rule strips the slash, or forcing HTTPS behind Cloudflare Flexible SSL, where the server always sees HTTP. This tool refuses rules that loop and names the line.
RewriteRule never sees the query string, so match it with a RewriteCond first: RewriteCond %{QUERY_STRING} ^id=42$, then the RewriteRule for the path. Add the QSD flag so ?id=42 is not copied onto the new address. Pasting /products?id=42 /products/blue-mug here writes both lines for Apache, or an if ($args) test for Nginx.
Every extra hop costs a little time, and Google follows at most 10 hops before giving up, so chains waste crawl effort and slow visitors. After a second site move, old addresses often point at pages that were redirected again. This generator spots each chain and rewrites the rule to point straight at the final page in one click.
Rates and rules change; check the source before you rely on a figure.
Still stuck? Ask about .htaccess Redirect Generator and anybody who knows can answer. No account needed.
Same job, other tools: Open Graph Tag Generator – Generate og:title, og:description, og:image and og:url tags · Google Analytics URL Builder – The five utm parameters GA4 reads, with the naming traps flagged.
On the related tools: Cron Expression Generator – Generate a cron expression by choosing when the job should run.