NitroSERP

Free .htaccess 301 Redirect Generator

Runs locally

Updated October 25, 2026

Generate Apache .htaccess 301 permanent and 302 temporary redirect rules for URL changes, HTTPS enforcement, and domain migrations.

RewriteEngine On
Redirect 301 /old-path https://example.com/new-path

How to use Htaccess Redirect Generator

Enter the old relative path (such as /old-page.html) and the new destination URL (https://www.example.com/new-page).

Select 301 (Permanent) for SEO migrations or 302 (Temporary) for short-term promos.

Copy the generated Apache .htaccess snippet, back up your existing .htaccess file, and test the redirect in an incognito browser.

Generate Apache .htaccess 301 & 302 redirect rules

When you rename a URL slug, consolidate two blog posts, or migrate a website to a new URL structure, leaving the old URL as a 404 Not Found wastes existing backlinks and search traffic. This free .htaccess redirect generator creates clean Apache redirect syntax ready to paste into your server configuration.

Common Apache .htaccess redirect patterns

Redirect ScenarioApache .htaccess SyntaxHTTP Status
Single Page Permanent MoveRedirect 301 /old-page https://www.example.com/new-page301 Moved Permanently
Single Page Temporary MoveRedirect 302 /promo https://www.example.com/summer-sale302 Found (Temporary)
Force HTTPS + www (mod_rewrite)See the RewriteCond / RewriteRule block below301 Moved Permanently
Entire Directory MoveRedirectMatch 301 ^/old-blog/(.*)$ https://www.example.com/blog/$1301 Moved Permanently

Force HTTPS and www in a single 301 hop:

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]

Post-redirect SEO migration checklist

  1. Back up your live .htaccess file first. A single syntax typo in .htaccess can trigger a 500 Internal Server Error across your entire site.
  2. Update internal links. Do not rely on 301 redirects for your own navigation or body links—update internal <a href> tags to point directly to the new canonical URL.
  3. Update your canonicals and XML sitemap. Generate updated <link rel="canonical"> tags with the canonical URL generator and refresh your XML sitemap so only the new 200 OK URLs are listed.

Htaccess Redirect Generator FAQs

Use a 301 Moved Permanently redirect whenever a URL has permanently changed location, been consolidated into another page, or migrated domains so Google transfers ranking signals to the new URL. Use a 302 Found (or 307) redirect only for temporary tests or seasonal promotions where you intend to restore the original URL.

More link & url tools and nearby utilities.

  • URL Encoder / Decoder

    Encode or decode URL components and query parameters using standard RFC 3986 UTF-8 percent-encoding locally in your browser.

    Open tool →
  • URL Shortener

    Turn long, parameter-heavy URLs and UTM campaign links into compact shareable short links via our server-side proxy with no account required.

    Open tool →
  • URL Parser / Inspector

    Break any absolute URL into its RFC 3986 / WHATWG components: protocol, hostname, port, path, individual query parameters, and fragment hash.

    Open tool →
  • UTM Campaign URL Builder

    Free UTM builder for Google Analytics 4 (GA4): append standardized utm_source, utm_medium, utm_campaign, utm_term, and utm_content parameters to any URL.

    Open tool →
View all link & url tools