Skip to content

HTACCESS Redirect Generator

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

.htaccess code


        

Paste this at the top of the .htaccess file in your site's root folder (Apache or LiteSpeed with mod_rewrite). Test in a private window: browsers cache 301 redirects.

Continue your work

Share this tool

Found it useful? Send it to a friend or teammate.

Rate this tool

0.0

0 ratings

  • 5 stars 0
  • 4 stars 0
  • 3 stars 0
  • 2 stars 0
  • 1 star 0

Click a star to rate this tool

Clear instructions

Find steps, examples and limitations below.

Use online

Open the tool in a supported web browser.

Free to use

No sign-up required. Tool-specific limits may apply.

How to use the HTACCESS Redirect Generator

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

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

Example and practical tips

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.

Frequently asked questions

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.

Report an issue

Something broken or not quite right? Tell us and we will look into it.