πŸ”€ Free .htaccess Redirect Generator

.htaccess Redirect Generator

Generate clean, ready-to-paste Apache .htaccess redirect rules β€” single 301 or 302 redirects in bulk, www to non-www, HTTP to HTTPS, and trailing-slash enforcement. Pick a tab, fill in the fields, and copy or download the rules. 100% in your browser β€” nothing is uploaded or stored.

Redirect specific old URLs to new ones. Enter one redirect per line as /old-path /new-path (paths or full URLs). A 301 is permanent and passes ranking signals; a 302 is temporary.

Force a single canonical hostname so www and non-www do not split your ranking signals. Enter your domain without the protocol.

Redirect every insecure HTTP request to HTTPS. This rule works on most shared hosts and preserves the requested path and query string.

Enforce a consistent trailing-slash style so each page has one canonical URL. Rules skip real files and directories so they do not break existing resources.

Your .htaccess rules
⚠️
Always back up your existing .htaccess before editing. Place redirect rules near the top of the file. These rules require Apache with mod_rewrite enabled β€” most shared hosts have it on by default. Test on a staging copy if you can.

πŸ”’ Everything runs in your browser. Nothing you enter is uploaded, logged or stored.

The .htaccess Redirect Generator writes correct Apache redirect rules for you, so you do not have to memorise mod_rewrite syntax or risk a typo that takes your site offline. It covers the four redirects nearly every site needs: pointing old URLs to new ones with a 301 or 302, forcing a single canonical hostname between www and non-www, pushing all traffic to secure HTTPS, and enforcing a consistent trailing-slash style. Each rule is generated as a clean, commented block you can copy straight into your .htaccess file or download ready to upload.

It is part of the Crawl & Indexing group in our free SEO Toolkit. Pair it with the Robots.txt Generator and Robots.txt Tester to control crawling, the XML Sitemap Generator to map your live URLs, the Redirect Chain Visualizer to spot redirect loops, and the URL Slug Generator to design clean new paths. Everything runs in your browser β€” nothing you enter is uploaded or stored.

4
Redirect Types
100%
Free Forever
0
Data Stored
99.9%
Uptime
β€” Features β€”

Correct Rules, No Guesswork

The redirects every site needs, generated cleanly.

301 & 302 Redirects

Map old URLs to new ones in bulk, one per line.

Canonical Host

Force www or non-www so signals do not split.

Force HTTPS

Send every insecure request to the secure version.

Private by Design

Rules are built in your browser β€” nothing leaves your device.

β€” How It Works β€”

Generate Rules in Seconds

From a few fields to ready-to-paste rules.

1

Pick a Type

Choose the redirect tab you need.

2

Fill the Fields

Enter URLs, domain or options.

3

Generate

Get clean, commented rules.

4

Copy or Download

Paste into your .htaccess file.

β€” Example β€”

A Force-HTTPS Rule

The exact output for redirecting all HTTP traffic to HTTPS.

Generated .htaccess block
# Force HTTPS on all requests
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

What Is an .htaccess Redirect Generator?

An .htaccess redirect generator builds the configuration rules that tell an Apache web server to send visitors and search engines from one URL to another. The .htaccess file is a per-directory control file that Apache reads on every request, and its mod_rewrite module is the standard way to implement redirects without touching your application code. The syntax is powerful but unforgiving β€” a stray character can return a 500 error and take the whole site down β€” so generating tested, correctly formatted rules removes the biggest risk. This tool produces clean, commented blocks for the redirects almost every website needs. It is part of the Crawl & Indexing group in the SEO Toolkit.

The Four Redirects You Will Actually Use

Most redirect work falls into four jobs. Single and bulk URL redirects move old pages to new ones β€” essential during a redesign or content reorganisation so you keep the ranking value of the old URLs. Canonical hostname rules pick either www or non-www as your one true domain, preventing search engines from treating the two as separate, competing sites. Force HTTPS sends every insecure request to the secure version, which is now expected for trust and ranking. Trailing-slash rules enforce one URL style so a page is not reachable at two addresses.

πŸ”€

301 vs 302

301 is permanent and passes ranking signals; 302 is temporary.

🌐

One Hostname

Consolidate www and non-www into a single canonical domain.

πŸ”’

Secure by Default

Force HTTPS so no visitor lands on an insecure page.

βž—

Slash Consistency

One URL per page avoids duplicate-content confusion.

Why 301 Redirects Matter for SEO

When you move or rename a page, a 301 permanent redirect is the single most important SEO action you can take. It tells search engines the page has moved for good and instructs them to transfer the old URL's accumulated ranking signals to the new one. Skip the redirect and you get a 404, the old rankings evaporate, and any links pointing at the old URL are wasted. Use a 302 only when the move is genuinely temporary, because a 302 does not reliably pass ranking value. When migrating many URLs, redirect each old URL to its closest matching new page rather than dumping everything on the homepage, which search engines may treat as a soft 404.

What This Generator Does

  • Builds single or bulk 301 and 302 URL redirects, one mapping per line
  • Generates www-to-non-www or non-www-to-www canonical rules
  • Optionally forces HTTPS within the hostname redirect
  • Creates a standalone force-HTTPS rule that preserves path and query
  • Adds or removes trailing slashes while skipping real files and folders
  • Wraps every rule in an IfModule guard and lets you copy or download it

How to Use the .htaccess Redirect Generator

  1. Choose the redirect tabSingle, www, HTTPS or trailing slash.
  2. Enter your detailsURLs, your domain, or the options.
  3. Generate the rulesA clean, commented block appears.
  4. Back up, then pasteAdd the rules near the top of .htaccess.

Technical Notes

Add them to the .htaccess file in your site's root directory, near the top and above any existing rewrite rules such as a WordPress block. Always download or copy a backup of the current file first. If the file does not exist you can create one, but make sure your hosting allows .htaccess overrides β€” most shared Apache hosts do.

A 301 is a permanent redirect: it tells browsers and search engines the move is final and transfers the old URL's ranking signals to the new one. A 302 is temporary and does not reliably pass ranking value, so reserve it for short-term changes like a sale page or maintenance. For migrations and renamed pages, almost always choose 301.

They are written for Apache with the mod_rewrite module, which powers most shared hosting. The IfModule wrapper means the block is simply ignored if the module is missing, rather than causing an error. They will not work on Nginx, which uses a different configuration syntax, so check which server your host runs if you are unsure.

No. The rules are assembled entirely in your browser with JavaScript, and the tool never makes a network request with your URLs or domain. Nothing you type is uploaded, logged or stored, so it is safe to use with unreleased domains and confidential client projects.

Common Use Cases

πŸ“¦

Site Migration

Map every old URL to its new home with 301s.

πŸ”’

HTTPS Rollout

Force secure connections after installing an SSL certificate.

🌐

Canonical Domain

Settle on www or non-www across the whole site.

🧹

URL Cleanup

Enforce one trailing-slash style site-wide.

Use the .htaccess Redirect Generator with these tools from the SEO Toolkit: control crawling with the Robots.txt Generator and test it with the Robots.txt Tester, map live URLs with the XML Sitemap Generator, find loops with the Redirect Chain Visualizer, design clean new paths with the URL Slug Generator, set page-level directives with the X-Robots-Tag Generator, and inspect URLs with the URL Parser.

β€” Who It's For β€”

Built for Everyone

Anyone managing URLs on an Apache server.

πŸ“ˆ SEO Specialists πŸ’» Web Developers πŸš€ Site Owners 🏒 Agencies πŸ›’ E-commerce Teams πŸ”§ Sysadmins πŸ“¦ Site Migrators πŸŽ“ Students & Learners
β€” FAQ β€”

Frequently Asked Questions

Everything about .htaccess redirects.

It builds correctly formatted Apache redirect rules for you to paste into your .htaccess file. It covers single and bulk 301 or 302 URL redirects, www to non-www canonicalisation, forcing HTTPS, and trailing-slash enforcement, each generated as a clean, commented block you can copy or download.

Yes, completely. There is no cost, no sign-up and no limit on how many rules you generate. The tool works entirely in your browser, so there are no server costs and nothing to pay for.

A 301 is a permanent redirect that tells search engines a page has moved for good and transfers its ranking signals to the new URL. A 302 is temporary and does not reliably pass ranking value. For migrations and renamed pages choose 301; reserve 302 for genuinely short-term changes.

Paste them into the .htaccess file in your website's root directory, near the top and above any existing rewrite blocks such as the default WordPress rules. Always back up the current file first, because a syntax error in .htaccess can return a server error until it is fixed.

They are written for Apache servers with the mod_rewrite module, which powers most shared hosting. The IfModule wrapper means the block is safely ignored if the module is unavailable. They do not work on Nginx, which uses a completely different configuration syntax, so check which server your host runs.

Either works for SEO β€” what matters is picking one and redirecting the other to it consistently, so search engines see a single canonical site rather than two competing versions. Choose whichever matches your brand and existing links, then apply the redirect across the whole domain.

HTTPS encrypts traffic between visitors and your site, which browsers now expect and flag when missing, and it is a lightweight ranking signal. Forcing HTTPS ensures no one lands on an insecure version of a page. You need a valid SSL certificate installed first, which most hosts provide free.

No. The generated rules include conditions that skip real files and directories, so requests for images, scripts, stylesheets and existing folders are left untouched. Only page-style URLs are normalised to your chosen slash style, which avoids the same page being reachable at two different addresses.

Yes. On the single and bulk tab, enter one redirect per line as the old path followed by the new path or URL. The generator turns each line into its own rule with your chosen 301 or 302 status, which is ideal for migrating a batch of renamed pages in one go.

No. The rules are assembled entirely in your browser with JavaScript, and the tool never sends your URLs or domain over the network. Nothing you type is uploaded, logged or stored, so it is safe to use with unreleased domains and confidential client work.

Yes. The generator is fully responsive, so you can build and copy redirect rules from a phone or tablet. The tabs, input fields, generated output and the copy and download buttons all work the same on small screens as they do on desktop.

Generate Your Redirect Rules Now

Build correct 301 and 302 redirects, www and HTTPS canonicalisation, and trailing-slash rules β€” then copy or download a ready-to-use .htaccess. Free, private and instant in your browser.

πŸ”€ Open the Generator ← All Crawl & Indexing Tools