.htaccess Redirect Generator

Generate 301 redirects and HTTPS/www rules for Apache and nginx.

Redirects That Reach The Final URL In One Hop

Moving pages, switching to HTTPS or settling on www versus the bare domain all come down to the same few rewrite rules — and they are easy to get subtly wrong. Paste your old and new addresses, tick the canonical rules you want, and get a ready-to-use .htaccess for Apache or a server block for nginx.

Every rule is written to send visitors and search engines straight to the final URL in a single redirect, combining scheme, host and path, because chains of redirects waste crawl budget and leak ranking. Your list is checked for chains, which are shortened automatically, and for loops, which would take a page offline.

Key features

  • Bulk 301, 302 or 308 redirects from a simple list.
  • Force HTTPS and www or non-www in one hop.
  • Hide .html, remove index.html and trailing slashes.
  • Chain and loop detection.
  • Apache and nginx output.
100% client-side — no data leaves your machine

This tool runs entirely inside your browser using native Web APIs. Your files and text are never uploaded to a server, never logged and never shared with third parties.

How to use: .htaccess Redirect Generator

  1. Enter your domain and canonical host
    Choose www or the bare domain — never both.
  2. List old and new paths
    One redirect per line, old first.
  3. Tick the site-wide rules
    HTTPS, index.html and extension handling.
  4. Download and test
    Try it on a staging copy before going live.

Technical specifications

Processing locationEntirely in your browser — no server round trip
Data uploadedNone. Files and text never leave your device
PriceFree — no account, no trial, no usage cap
CategoryDeveloper
Works offlineYes, once the page has loaded
Browser supportChrome 90+, Edge 90+, Firefox 90+, Safari 15+
Interface languagesEnglish, 中文, हिन्दी, Español, العربية

Frequently asked questions

What is the difference between a 301 and a 302 redirect?

A 301 is permanent: browsers cache it and search engines move ranking to the new URL. A 302 is temporary and keeps the old URL indexed. Use 308 for a permanent move that must keep the request method, such as a POST form.

Why avoid redirect chains?

Each extra hop adds latency and some crawlers stop following after a few. Chains like http://site → https://site → https://www.site should be a single redirect straight to the end.

Should I use www or not?

Either works for SEO. What matters is choosing one, redirecting the other to it, and using it consistently in canonical tags, sitemaps and internal links.

Where does the .htaccess file go?

In your site’s document root, usually public_html. It needs Apache with mod_rewrite enabled, which almost every shared host provides.

Why does forcing HTTPS mention X-Forwarded-Proto?

Behind a CDN or load balancer, Apache may only see plain HTTP even for secure visits. Checking the forwarded protocol stops an endless redirect loop.

Related tools

Back to all tools