Htaccess Redirect Generator – Create 301 & 302 Rules for Apache

Htaccess Redirect Generator


1. Select redirect type





2. Enter your domain name


Do not include www. Domain name only - e.g. yourdomain.com

3. Get your code


4. Copy the code to your .htaccess file



About Htaccess Redirect Generator

Htaccess Redirect Generator builds ready‑to‑use redirect rules for Apache .htaccess. It is useful when moving pages, forcing HTTPS, or changing domains.

How to Use Htaccess Redirect Generator

  1. Select the redirect type you want to use (redirect from www to non‑www or from non‑www to www).

  2. Enter your domain name in the field (domain only, without www or https://).

  3. Click the Get .htaccess Code button to generate the redirect rules.

  4. Copy the generated code from the box and paste it into your website’s .htaccess file on the server, then save the file.

FAQ

  • What is a 301 redirect?
    It is a permanent redirect that passes most SEO value to the new URL.

  • Should I back up .htaccess?
    Always back up before editing to avoid site‑wide errors.