130 of 149 tools live Roadmap LatestImage to Text

.htaccess Redirect Generator

Correct Apache .htaccess rules for one redirect or hundreds, with https and www handled.

Works in your browser. Nothing you type is sent to us.

Whole-site rules

Page redirects

One per line: the old path, a space or comma, the new path or full address. Paste a CSV export too. End the old path with * to redirect everything under it; use :splat in the new one to keep the rest.

.htaccess

    Written in your browser. Nothing you type is sent to us.

    .htaccess Redirect Generator at a glance

    Price
    Free
    Data sent to us
    None, it runs in your browser
    Sign-up
    Not needed
    Servers
    Apache, Nginx, Netlify, Vercel, Cloudflare
    Codes
    301, 302, 307, 308
    Input
    Lines or CSV: old path, new address, optional code

    How to use .htaccess Redirect Generator

    Takes about 1 minute. You need the old paths and their new addresses.

    1. Choose the server and the kindPick Apache, Nginx, Netlify, Vercel or Cloudflare, and 301 for a permanent move.
    2. List the redirectsType the old path and the new address on each line, or open a CSV. Add whole-site rules such as http to https if you need them.
    3. Copy the rulesRead any warnings, then copy the rules or download the file and put it where the note under it says.
    Redirect Generator: Paste old and new addresses, get correct redirect rules for your server, with loops and chains caught.

    Paste the old paths and new addresses and copy RewriteRule lines for the .htaccess file at your site root. Each path is escaped so dots match literally and anchored so a rule for one page does not catch others; wildcard rules keep the rest of the path. Tick the whole-site rules for http to https, www to bare domain or the reverse, and trailing slashes. Duplicate, looping and chained rules are pointed out before you paste.

    How it works

    .htaccess Redirect Generator is a web page that does its work on your own device. The file you choose is opened by your browser, changed there and saved from there; it is never sent to a server, so there is no copy of it anywhere to delete, no queue and no waiting for an upload. Most online tools of this kind send your file to their servers and work on it there, and many keep it for a while. This one does not. There is no account, no watermark and no limit on how often you use it, and the result downloads the moment it is ready.

    Order matters in .htaccess

    Put these rules near the top of the file, before any rules a CMS added, with RewriteEngine On once. The first matching rule with [L] ends processing, so a page rule above a catch-all works and the reverse does not.

    Questions

    Why does my redirect not work on Apache?

    Usually mod_rewrite is off or AllowOverride is not set for the folder, so the .htaccess is ignored, or a rule earlier in the file catches the request first. Check the server error log and try the rule alone.

    Other shortcuts

    More

    Privacy policy · Support · Changelog

    Suggest a tool

    Tell us what the tool should do. If we build it, we will let you know.

    Used only to reply to you. See our Privacy Policy.