Skip to content
D DocNectar

Free .htaccess Redirect Generator

Generate a 301 or 302 .htaccess redirect rule for Apache servers.

100% Free No Signup Works on all devices

Built and fact-checked by the DocNectar team — see our editorial standards

Thanks for rating!

Key Features

Instant Calculation

Get accurate results in real time with our optimized algorithm.

Mobile Friendly

Fully responsive design. Works on all devices & screen sizes.

Privacy Focused

Your data stays on your device. We don't store any inputs.

100% Free

No hidden costs. This tool is completely free forever.

Redirecting an old URL to a new one is a common task when restructuring a site, and getting the .htaccess syntax and status code right matters for both users and search engines.

This tool generates a ready-to-paste Apache Redirect rule for your .htaccess file.

How it works

Enter the old path (relative to your site root), the full new URL, and whether the move is permanent or temporary. The tool builds a standard Apache mod_alias Redirect directive using the correct status code (301 or 302) for your choice.

  1. Enter old path (relative to site root).
  2. Enter new URL.
  3. Enter redirect type.
  4. Click Calculate to see your results.

Examples

A permanent page move

Redirecting /old-page to https://example.com/new-page permanently produces: Redirect 301 /old-page https://example.com/new-page

Who should use it

  • Redirecting an old URL to a new one after restructuring a site.
  • Setting up redirects during a domain or platform migration.

Industry applications

  • Web development and site migrations
  • SEO and technical SEO audits

Advantages

  • Generates correct Apache syntax instantly, with the right status code for your situation.
  • Explains the SEO difference between permanent and temporary redirects.

Limitations

  • Only applicable to Apache servers using .htaccess — not Nginx or other web servers.

Common mistakes to avoid

  • Using a 302 (temporary) redirect for a permanent page move, which prevents search engines from properly transferring the old page's ranking to the new URL.
  • Forgetting that .htaccess redirect rules are specific to Apache and won't work on an Nginx server.

Best practices

  • Use 301 permanent redirects whenever a page move is final — this is the standard SEO-safe way to preserve search rankings after restructuring a site.

Tips

  • After adding a redirect, test it directly in your browser (or with a tool that shows HTTP status codes) to confirm it returns the status code you intended, since a misconfigured .htaccess file can sometimes cause a server error instead.

Frequently asked questions

Yes, with no signup and no limit on how many rules you generate.
Use 301 (permanent) when a page has moved for good — search engines will transfer its ranking signals to the new URL over time. Use 302 (temporary) when the move is short-term, since the old URL keeps its ranking signals in that case.
Add the generated line to the .htaccess file in your site's root directory (or the relevant subdirectory), which Apache reads automatically for URL rewriting and redirect rules.
No — .htaccess files and the Redirect directive are specific to the Apache web server. Nginx uses a different configuration syntax for redirects.

Get new calculators and guides in your inbox

No spam — just new tools like Htaccess Redirect Generator and practical guides.

Favorites