HTACCESS Redirect Generator

Easily generate .htaccess code snippets for 301, 302, and other common redirects.

How to use this tool

Enter each redirect pair in a separate row. For each redirect, provide the Old URL (where users are coming from) and the New URL (where they should be redirected to).

Example: If yoursite.com/old-about.html moved to yoursite.com/about:
Old URL: /old-about.html
New URL: /about

The tool generates redirects for your .htaccess file. Each redirect preserves your SEO rankings when moving pages.

301: SEO-friendly permanent redirect (most common) • 302: Temporary redirect • 307/308: Modern HTTP/1.1 equivalents

Common Redirect Templates

Enter Your URL Redirects

About .htaccess Redirects

The .htaccess file is a configuration file for Apache web servers that allows you to control redirects, URL rewrites, and other server behaviors without modifying the main server configuration.

Key Features
  • 301 Redirects - Permanent (SEO-friendly)
  • 302 Redirects - Temporary redirects
  • SEO Preserved - Maintains rankings
  • No Restart - Works immediately
Common Use Cases
  • Moving pages to new URLs
  • Domain migrations
  • Fixing broken links
  • Consolidating duplicate content
Important Notes
  • Backup First: Always backup your .htaccess file before making changes
  • Placement: Add redirect rules at the top of your .htaccess file
  • Testing: Test redirects in incognito/private mode to avoid caching
  • Old URLs: Must start with / for same-server redirects
  • New URLs: Can be relative (/page) or absolute (https://example.com/page)
Redirect Type Reference
301 Permanent: Page moved permanently. Search engines transfer rankings. Use for permanent URL changes.
302 Temporary: Page moved temporarily. Search engines keep original URL indexed. Use for A/B testing or maintenance.
307 Temporary: HTTP/1.1 temporary redirect. Preserves request method (POST stays POST).
308 Permanent: HTTP/1.1 permanent redirect. Like 301 but preserves request method.
  1. 1 Choose Redirect Type: Select 301 (Permanent) for a permanent move, or 302 (Temporary) for a short-term change.
  2. 2 Enter URLs: Input the Old URL (Source) and the New URL (Destination).
  3. 3 Generate Code: Click "Create .htaccess Code".
  4. 4 Implement: Paste the resulting `Redirect 301` or `RewriteRule` snippet into your website's .htaccess file.
This website uses Cookies to ensure optimal user experience.