Redirect Generator
Generate 301/302 redirect rules for Apache .htaccess, Nginx, and Cloudflare.
How to Use
- Enter the old (source) URL path and the new (destination) URL for each redirect.
- Select 301 (permanent) or 302 (temporary) for each rule.
- Choose your server type: Apache, Nginx, or Cloudflare.
- Copy the generated rules and add them to your server configuration.
When to Use This
- Migrating a blog to new URL patterns, where fifty old paths need rules and typing RewriteRule fifty times invites typos.
- Switching the same redirect list from Apache to Nginx after a hosting move, without rewriting every rule by hand.
- Preparing a redirect map as a deliverable for a developer or host who will apply it, in the syntax their stack actually uses.
- Retiring a handful of thin pages into their closest surviving equivalents, with the 301s written consistently rather than ad hoc.
Frequently Asked Questions
About This Tool
A redirect is an HTTP response carrying a status in the 3xx range and a Location header pointing at another URL, which the client then requests instead. A 301 says the move is permanent and invites clients and crawlers to remember it; a 302 says the original address will be back. The rule itself lives in server configuration, which is why the same redirect is written three different ways depending on what serves the site.
This tool takes a list of old path and new URL pairs, each tagged 301 or 302, and writes them for one of three targets: Apache RewriteRule lines preceded by RewriteEngine On, Nginx rewrite directives for a server block, or a JSON array of source, destination and permanent fields. The output downloads as .htaccess, redirects.conf or redirects.json.
Notes & Limits
- The Apache pattern escapes only dots and question marks. Other regex characters, among them plus signs, parentheses and brackets, stay live and can overmatch.
- RewriteRule matches the path alone, so a source with a query string will not match. That needs a RewriteCond on %{QUERY_STRING}, which this tool does not write.
- The JSON option emits source, destination and permanent keys. Check what field names your platform's bulk-redirect importer expects, since this shape is not universal.
- Nothing detects a chain or a loop. If one rule's destination is another rule's source, both are written out and the server will follow them in turn.