.htaccess Redirect Generator
Turn an old path and a new path into a ready-to-paste 301 or 302 redirect rule for Apache's .htaccess, free, right in your browser. Pro adds bulk redirect generation, Nginx syntax, wildcard redirects, and www/HTTPS boilerplate — nothing is ever uploaded.
✓ www/HTTPS Boilerplate Snippets · Duplicate & Loop Detection
How to Use the .htaccess Redirect Generator
Paste an old path and a new path and get a ready-to-use redirect rule in seconds — everything runs in your browser, with no signup and nothing uploaded.
Everything above runs entirely in your browser using plain JavaScript. Your old paths, new paths, and any bulk list you paste are never uploaded to a server.
.htaccess Redirect Generator: Build a 301 or 302 Redirect Rule, Free, Right in Your Browser
Quick answer: Enter the old path, the new path, and pick 301 Permanent or 302 Temporary, and the tool writes a ready-to-paste Apache .htaccess rule. Pro Mode adds bulk generation for a whole list of redirects at once, an Apache/Nginx syntax toggle, wildcard redirects for an entire old directory, one-click www and HTTPS boilerplate, and automatic duplicate and loop detection. It's free, with no signup, and nothing is uploaded to a server.
A redirect tells a browser, and a search engine, that a page has a new address. Get it wrong and visitors land on a 404, search rankings for the old page vanish instead of transferring, or a careless rule sends traffic in a circle until the browser gives up with a "too many redirects" error. Most site owners either hand-edit an .htaccess file by copying a line from an old blog post, or reach for one of the many existing htaccess redirect generator tools that already cover this exact job, from hosting-company utilities to dedicated SEO-agency tools. This one keeps the same idea, built entirely in the browser: fill in two paths, pick a redirect type, and get back the exact line to paste.
Searches for a 301 redirect generator and an apache redirect generator turn up dozens of similar tools, and a growing number of them, alongside nginx redirect generator results, now cover both server types in one place rather than assuming every site runs Apache. This tool follows that same pattern: Simple Mode sticks to the classic Apache .htaccess line, and Pro Mode adds Nginx as a second output format for the identical rule.
1How a Single Redirect Rule Gets Built
Type the old path (or paste a full URL, the domain part is stripped automatically) and the new path, choose 301 or 302, and click Generate Redirect Rule. In Simple Mode the output is an Apache Redirect directive, the mod_alias line most hosting documentation leads with because it needs no extra Apache module configuration: Redirect 301 /old-page /new-page. In Pro Mode the same inputs can instead produce an Nginx location block using a return directive, the syntax Nginx's own documentation recommends over the older rewrite directive for a simple one-to-one redirect.
2Simple vs Pro
| Feature | Simple | Pro |
|---|---|---|
| Single redirect rule from an old path and a new path | ✓ | ✓ |
| 301 Permanent & 302 Temporary redirect types | ✓ | ✓ |
| Apache .htaccess output | ✓ | ✓ |
| Nginx output (location / return syntax) | — | ✓ |
| Bulk redirect generation from a pasted list | — | ✓ |
| Wildcard redirects for an entire old directory | — | ✓ |
| www ↔ non-www and HTTP → HTTPS boilerplate snippets | — | ✓ |
| Duplicate, conflict & redirect-loop detection | — | ✓ |
Simple Mode covers the one-off case: a single page that moved, scored and written out in a few seconds. Pro Mode is built for the messier real-world job, a site migration or a batch of retired blog posts, where dozens of old URLs need new homes at once and a single typo can quietly break a rule or loop two pages into each other.
3Bulk Generation, Wildcards, and Site-Wide Boilerplate
Pro Mode's Bulk Redirect Generator accepts one old-path, new-path pair per line, with an optional redirect type, separated by a comma, a tab, or an arrow, the loose format real redirect spreadsheets and CSV exports tend to use. It builds the whole block in one pass rather than one line at a time, matching the bulk-redirect tools that agencies and larger sites already rely on for site migrations. The Wildcard / Directory Redirect card handles the related but different case of moving an entire old directory, like an old blog category, to a new one in a single pattern-based rule instead of writing out every individual page. The www / HTTPS Boilerplate card covers the two most common site-wide redirects: canonicalizing www to non-www (or the reverse) and forcing HTTPS, both frequent how-to searches on their own, generated as one ready-to-paste block for either Apache or Nginx.
4Common Reasons People Generate a Redirect
None of these need a developer on standby to get the syntax exactly right. An old path, a new path, and the right redirect type are enough to produce a rule that's safe to paste the same session.
5Catching Redirect Loops Before They Reach Production
A "too many redirects" error, the exact phrase behind one of the most common redirect-related searches, happens when a chain of rules eventually leads back to a page it already passed through, and the browser gives up rather than loop forever. It is an easy mistake to make by hand once a list grows past a handful of rules, especially after a second migration adds new redirects on top of old ones that were never cleaned up. Pro Mode's Duplicate & Loop Check walks every rule in a bulk list, follows each one to its final destination, and flags three distinct problems: an old path that appears more than once, two rules that send the same old path to different targets, and a chain that loops back on a page already in its own path. It also flags long redirect chains that resolve correctly but hop through more than one rule, worth tidying up even when they're not technically broken, since every extra hop adds a round trip for both visitors and crawlers.
Every old path, new path, and bulk list this tool reads, along with every rule it builds, is processed entirely by JavaScript running in your own browser. Nothing is uploaded, logged, or transmitted to a server at any point, in Simple Mode or Pro Mode.
6Frequently Asked Questions
Built on the documented redirect standards. The 301/302 status-code behavior this tool explains, and the Apache and Nginx syntax it generates, match the HTTP redirection semantics documented in MDN's HTTP redirections guide, rather than an arbitrary or estimated interpretation.
More SEO & GEO Tools
Every other tool in the SEO & GEO Tools category