Skip to content

How to Use HTACCESS Redirect Generator

Generate .htaccess redirect rules for Apache: single page and folder 301s, domain moves, HTTP to HTTPS, www or non-www, trailing slashes and extensions.

About this tool

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

How to use HTACCESS Redirect Generator

  1. Choose the redirect type and status code (301 for permanent moves).
  2. Fill in the paths or domains the rule needs.
  3. Copy the code to the top of the .htaccess file in your site’s root folder and test it in a private window.

Worked example

To move to HTTPS and www in one hop, choose “HTTP to HTTPS and www”. The rule sends http://example.com/page straight to https://www.example.com/page.

Does this work on Nginx?

No. .htaccess files are read by Apache and LiteSpeed. Nginx uses return or rewrite directives in its server configuration.

Why test in a private window?

Browsers cache 301 redirects, so an old rule can keep working in your normal window even after you change it.

Put this guide into practice

Explore Webmaster & SEO Tools · More practical guides

Accessibility Menu

Personalize your experience. Open with Ctrl+U (Option+U on Mac). Preferences stay in this browser when storage is available.

Move / Hide Widget

Restore at any time with Ctrl+U (Option+U on Mac).

Accessibility statement and help