Redirect Generator (.htaccess & Nginx)
Generate 301 and 302 redirect rules for Apache .htaccess or Nginx.
RewriteEngine On
Redirect 301 /old-page https://example.com/new-page
About the Redirect Generator (.htaccess & Nginx)
Draft 301/308 permanent or 302/307 temporary redirects. Status 307/308 is intended to preserve the request method, but server configuration and clients still need testing. This page generates text and does not configure a host or guarantee SEO signal transfer.
Apache output starts with RewriteEngine On but the rules themselves use Redirect directives, not RewriteRule. Nginx output uses location = path plus return. These are different matching mechanisms: do not assume Apache prefix/path handling and Nginx exact matching are interchangeable.
A full source URL is reduced to its path and query by the helper, discarding its hostname. Query-containing source strings are not translated into proper server query-matching conditions, and spaces/special characters are not comprehensively escaped. Use simple path sources and review advanced rules manually.
Key features
- 301, 302, 307 and 308 redirects
- Apache .htaccess and Nginx output
- Add as many redirects as you need
- Copy-ready configuration
How to use
- 1Choose Apache or Nginx and the intended status. Enter simple old paths and reviewed destination URLs; rows with either side blank are omitted.
- 2Check for host changes, query strings, special characters, loops and conflicting existing rules; the generated draft is not a server validator.
- 3Back up configuration and test the syntax and real response on your own server before deployment. This browser page never deploys the rules.
Examples
/old-page to https://example.com/new-page using 301Apache Redirect 301 rule or matching Nginx ruleTest redirect rules in a staging environment before changing a production server configuration.
Source /old-page, destination https://example.com/new-page, status 301Apache: Redirect 301 /old-page https://example.com/new-page
Nginx: location = /old-page { return 301 https://example.com/new-page; }Illustrates the rule constructs, not identical prefix matching or a tested deployment.
Frequently asked questions
- Which redirect should I use for SEO?
- Use an appropriate permanent status such as 301 or 308 for a genuinely permanent move, and temporary status for a temporary change. Verify the destination and method handling; no ranking or traffic-preservation guarantee.
- Where do .htaccess rules go?
- Apache output uses mod_alias Redirect directives, plus a RewriteEngine On header requiring mod_rewrite if retained. .htaccess directives must be permitted by your host's AllowOverride configuration. Review and syntax-test before applying.
- How do I use the Nginx output?
- Review location blocks within the appropriate server context, run your server's configuration test, then apply/reload deliberately. An exact location containing a query string is not generated query-condition handling.
Continue your workflow
Open a related tool to prepare your files or refine the finished result.
- Web & SEORobots.txt Generator
Draft robots.txt crawler rules from paths, presets and sitemap entries; review before publishing.
Open tool - Web & SEOUTM Campaign URL Builder
Build trackable campaign URLs with UTM parameters for analytics.
Open tool - Featured toolDeveloper ToolsHTTP Status Code Lookup
Search HTTP status codes and read what each one means.
Open tool
