.htaccess redirect generator

Generate .htaccess rules for 301 redirects, HTTPS and www.

  • SEO
  • 100% free
  • No sign-up
  • Runs in your browser
.htaccess redirect generator
One redirect per line: the old path, a space, then the new path or URL.
Moves the whole site to another domain.

What is the .htaccess redirect generator?

The .htaccess redirect generator writes mod_rewrite rules for the most common redirects: single pages, a whole domain move, HTTPS, www or non-www and trailing slashes. The rules work on Apache and LiteSpeed servers, which run most shared hosting.

Permanent 301 redirects pass the ranking signals of the old URL to the new one, so they're essential after changing URLs, moving to HTTPS or migrating a website.

How to use the .htaccess redirect generator

  1. 1List the page redirects: old path, a space, new path or URL.
  2. 2Choose the redirect type and the HTTPS, www and trailing slash options.
  3. 3Copy the rules to the top of the .htaccess file in the root of your site.

Features

Page redirects

Old paths are escaped for regular expressions automatically.

HTTPS and www

Force HTTPS, www or non-www in one click.

Domain moves

Send a whole site to a new domain, keeping the paths.

301 or 302

Permanent or temporary redirects.

Frequently asked questions

What is the difference between 301 and 302?

301 is permanent and passes ranking signals to the new URL; 302 is temporary and keeps the old URL in the index.

Where is the .htaccess file?

In the root folder of the website (often public_html). It's a hidden file, so enable hidden files in your file manager.

Does .htaccess work on Nginx?

No, Nginx doesn't read .htaccess files. The redirects must be added to the server configuration.

How do I test a redirect?

Use the redirect checker to follow the redirect chain and see the status codes.