Free .htaccess 301 Redirect Generator
Runs locallyUpdated 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-pathHow 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 Scenario | Apache .htaccess Syntax | HTTP Status |
|---|---|---|
| Single Page Permanent Move | Redirect 301 /old-page https://www.example.com/new-page | 301 Moved Permanently |
| Single Page Temporary Move | Redirect 302 /promo https://www.example.com/summer-sale | 302 Found (Temporary) |
Force HTTPS + www (mod_rewrite) | See the RewriteCond / RewriteRule block below | 301 Moved Permanently |
| Entire Directory Move | RedirectMatch 301 ^/old-blog/(.*)$ https://www.example.com/blog/$1 | 301 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
- Back up your live
.htaccessfile first. A single syntax typo in.htaccesscan trigger a500 Internal Server Erroracross your entire site. - 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. - 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 new200 OKURLs are listed.
Htaccess Redirect Generator FAQs
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.Related Link & URL Tools
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 →