301 Redirect Generator (.htaccess)

Generate Apache .htaccess redirect rules from old and new paths, as 301 permanent or 302 temporary.

Input
Result
For Apache servers (mod_alias). Nginx, Cloudflare and most hosting panels use a different syntax. Test on a staging copy first.

About 301 Redirect Generator (.htaccess)

The .htaccess Redirect Generator writes Apache redirect rules from your old and new page addresses, so visitors and search engines land on the right page after you move or rename content.

301 or 302?

301 is for pages that moved for good, so search engines pass the old page's ranking to the new one. 302 is for temporary moves.

Enter pairs

Old path and new path for each page.

Back up first

Save a copy of your .htaccess before editing; one mistake can take the site down.

Test after saving

Try the old addresses with and without a trailing slash.

Apache only

Nginx and other servers use a different syntax.

How to use 301 Redirect Generator (.htaccess)

  1. Enter each redirect as the old path and the new path or URL, one pair per line.
  2. Choose 301 Permanent or 302 Temporary.
  3. Copy the generated rules.
  4. Add them to your .htaccess file and test.

Help & FAQ

Can we create many 301 redirects at once (bulk)?

Yes. Paste one old path and one new path per line, as many lines as needed, and the generator writes one Apache .htaccess block with a redirect rule for every line. Choose 301 for permanent moves or 302 for temporary ones, then paste the block into the .htaccess file in the site root.

How do 301 and 302 redirects differ in the Apache rules generated by .htaccess Redirect Generator?

A 301 indicates a permanent move, telling search engines to replace the old URL with the new one. A 302 indicates a temporary move, so the old URL should be retained.

What format should each line have?

Each line needs exactly two values: the old path and the new path or full URL.

Will this work on every server?

It is for Apache and compatible servers that read .htaccess files. Nginx and other servers use different configuration.

How do we redirect one page to another with .htaccess?

Add a line such as Redirect 301 /old-page /new-page to your .htaccess file, then test it.

Does the generator work for whole-site redirects?

It creates path to path rules. For a whole domain move, use a rule that matches your hosting setup and check with your host.

Is there a free 301 redirect generator?

Yes. Enter the old and new paths, choose 301 and copy the rules into your .htaccess file.

More in SEO & Website

See all 15 in SEO & Website