QuickSEO
PricingToolsBlog
Get Started

Free .htaccess Redirect Generator

Generate Apache .htaccess redirect rules instantly. Choose between 301 permanent and 302 temporary redirects, add individual page redirects, redirect an entire domain, and get copy-ready code to drop straight into your server configuration.

Redirect Type

Use 301 for permanent moves — passes full link equity to the new URL.

Add Page Redirects

Generated .htaccess

Upload or merge this code into your .htaccess file in your Apache server root.

Track and Grow Your Brand Across Google & AI

See how your brand performs across Google Search and AI chatbots like ChatGPT, Claude, Gemini, and Perplexity. One dashboard. No guesswork.

Try QuickSEO →

What Is an .htaccess File?

An .htaccess (hypertext access) file is a directory-level configuration file used by Apache web servers. It allows you to control server behavior on a per-directory basis without modifying the main server configuration. Common uses include URL redirects, URL rewrites, access control, custom error pages, and caching rules.

The file must be named exactly .htaccess (with a leading dot) and is typically placed in your website's root directory or within specific subdirectories. It is processed by Apache on every request to that directory, so keeping it concise is important for performance.

Options +FollowSymLinks
RewriteEngine On

# Redirect old page to new page
Redirect 301 /old-page https://example.com/new-page

# Redirect entire domain
RewriteCond %{HTTP_HOST} ^old-domain\.com$ [NC]
RewriteRule ^(.*)$ https://new-domain.com/$1 [R=301,L]

301 vs 302 Redirects: Which Should You Use?

The choice between a 301 and 302 redirect has significant SEO implications:

  • 301 Permanent Redirect — Tells search engines the page has moved permanently. Link equity (PageRank) passes to the new URL. Browsers cache 301 redirects, so users are sent directly to the new URL on repeat visits. Use 301 when permanently moving or deleting a page.
  • 302 Temporary Redirect — Tells search engines the page has moved temporarily. Link equity stays with the original URL. Browsers do not cache 302 redirects. Use 302 for A/B testing, maintenance mode, or when you plan to restore the original URL.

In practice, the vast majority of redirects you write will be 301s. Only use 302 when you genuinely intend the original URL to return and do not want to transfer ranking signals.

.htaccess Redirect Best Practices

  • Back up your existing .htaccess first — Syntax errors in .htaccess can cause a 500 Internal Server Error and take your site offline
  • Avoid redirect chains — A redirects to B which redirects to C is a chain; collapse it so A redirects directly to C to preserve link equity and improve page speed
  • Use absolute URLs for the destination — Include the full URL with protocol (e.g. https://example.com/new-page)
  • Keep your old paths as relative paths — Old paths in Redirect directives should start with / and not include the domain
  • Test after deployment — Use a redirect checker to verify status codes and ensure no loops were created
  • Place specific rules before broad rules — More specific paths should appear before general catch-all patterns in the file

Track and Grow Your Brand Across Google & AI

See how your brand performs across Google Search and AI chatbots like ChatGPT, Claude, Gemini, and Perplexity. One dashboard. No guesswork.

Try QuickSEO →

Related Tools

Redirect Checker

Check redirect chains, status codes, and detect redirect loops for any URL.

Robots.txt Generator

Generate a robots.txt file with AI crawler directives and custom rules.

QuickSEO

HomeBlogTemplatesFree ToolsDocs

AI Visibility Tools

Claude SEO Rank TrackerChatGPT SEO Rank TrackerGemini SEO Rank TrackerPerplexity SEO Rank Tracker

Features

Branded vs Non-Branded

Track

ChatGPTClaudeGeminiPerplexity

Legal

Terms of usePrivacy policy

Contacts

support@quickseo.ai