The .htaccess Redirect Generator builds Apache redirect rules for you — custom old-to-new URL redirects with 301 or 302 status, plus common rules to force HTTPS and standardize www usage.
What is an .htaccess Redirect Generator?
The .htaccess file is a configuration file for the Apache web server that controls how the server handles requests for a directory and its subdirectories. One of its most common uses is defining redirects — sending visitors and search engines from an old URL to a new one. Writing these rules by hand is fiddly and easy to break.
This generator builds correct redirect rules for you. It supports two styles — the simple Redirect directive and the more flexible mod_rewrite RewriteRule — and includes ready-made common rules for forcing HTTPS and standardizing the www prefix.
How to Generate Redirect Rules
- Choose a style: the Redirect directive or mod_rewrite RewriteRule
- Pick 301 (permanent) or 302 (temporary) for the status code
- Add each old path and its destination URL in the redirect rows
- Toggle common rules like Force HTTPS or www handling as needed
- Copy the generated block and paste it into your site's .htaccess file
301 vs 302 Redirects
A 301 redirect tells browsers and search engines that a page has moved permanently. Search engines transfer the old page's ranking signals to the new URL, which makes 301 the right choice for permanent moves, site migrations, and consolidating duplicate URLs.
A 302 redirect indicates a temporary move; search engines keep the original URL indexed. Use 302 for temporary maintenance pages, A/B tests, or short-term promotions where you intend to restore the original URL later. Choosing the wrong type can harm your SEO, so this distinction matters.
Common Redirect Scenarios
Forcing HTTPS ensures every visitor uses a secure connection, which is essential for security and is a confirmed ranking signal. Standardizing on either www or non-www prevents search engines from treating the two as separate sites with split ranking authority. Per-URL redirects preserve traffic and link value when individual pages move or are renamed. This tool generates all of these correctly so you avoid redirect loops and syntax errors.
Related searches
Recommended Web Dev & Coding tools
Explore more free online tools related to .htaccess Redirect Generator.
SQL Formatter
Beautify and indent SQL queries across multiple dialects, with keyword casing options.
SVG Optimizer / Cleaner
Clean and shrink SVG files by removing editor cruft, comments, and metadata, with a live preview.
Placeholder Image Generator
Create custom placeholder images with any size, colors, and label, then download as PNG.
Favicon Generator
Create a favicon from a letter or emoji with custom colors and shape, and download multiple sizes.
Meta Viewport Generator
Build the responsive viewport meta tag with presets for scaling, zoom, and notched devices.
HTTP Status Code Reference
Search and browse HTTP status codes with clear explanations, grouped by category.