Skip to content
ToolsOnDuty - free online tools
Web & SEO

Redirect Generator (.htaccess & Nginx)

Generate 301 and 302 redirect rules for Apache .htaccess or Nginx.

Free foreverRuns in your browserNo sign-up
.htaccess
RewriteEngine On

Redirect 301 /old-page https://example.com/new-page

About the Redirect Generator (.htaccess & Nginx)

Redirects send visitors and search engines from an old URL to a new one, preserving traffic and link value when you move or rename pages. This tool writes the rules for you.

Enter your old and new URLs, choose the redirect type (301 permanent is the usual choice for SEO), and switch between Apache .htaccess and Nginx output.

The rules are generated in your browser, ready to paste into your server configuration.

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

  1. 1Choose your server and redirect type.
  2. 2Add each old path and its new destination URL.
  3. 3Copy the rules into your .htaccess or Nginx config.

Frequently asked questions

Which redirect should I use for SEO?
Use a 301 permanent redirect when a page has moved for good. It passes the most ranking signals to the new URL.
Where do .htaccess rules go?
Place them in the .htaccess file in your site's root directory. Apache must have mod_rewrite and AllowOverride enabled.
How do I use the Nginx output?
Paste the location blocks inside the relevant server block of your Nginx config, then reload Nginx.