Small SEO Tools

Htaccess Redirect Generator

301 rules without the guesswork. Free, no sign up, and everything happens inside your browser.

The .htaccess file lets you change how Apache handles requests without touching the main server config. Most of what people need from it is redirects: moving a page, moving a whole domain, settling on one hostname, forcing HTTPS, or deciding whether URLs end in a slash. Writing those rules by hand is easy to get wrong, and a bad RewriteCond can produce a redirect loop that takes the site down until someone edits the file back.

This generator writes each rule set with a short comment above it so you know what the block does when you come back to the file later. Single page redirects let you choose between 301 and 302: a 301 is permanent and consolidates ranking signals on the new URL, a 302 keeps the original indexed and is for genuinely temporary moves. Back up your existing .htaccess before pasting anything in, and test on a staging copy where you can.

How to use the Htaccess Redirect Generator

  1. Pick the redirect type you need from the dropdown. The form fields change to match it.
  2. Fill in the paths, domain or error page location, and choose 301 or 302 where the option appears.
  3. Click Generate Rules and read the note underneath, which flags the common traps for that rule type.
  4. Back up your current .htaccess, paste the block in, upload it to your site root, then test the redirect in a private browser window.

Frequently asked questions

When should I use 301 instead of 302?

Use 301 when the move is permanent. It tells search engines to replace the old URL with the new one and to pass ranking signals across. Use 302 only when the original URL will genuinely come back, such as during maintenance or a short term promotion, since a 302 keeps the old URL indexed.

Why is my site stuck in a redirect loop?

Usually two rules fighting each other, such as force trailing slash sitting alongside remove trailing slash. It also happens when a proxy like Cloudflare terminates TLS, so the HTTPS variable reads as off on every request. Use the X-Forwarded-Proto condition in that setup.

Where does the .htaccess file go?

In the document root of your site, alongside the main index file. Rules apply to that directory and everything below it. The server must have mod_rewrite loaded and AllowOverride set to permit the directives, otherwise the file is read and quietly ignored.

Do these rules work on Nginx?

No. The .htaccess file is an Apache feature, and LiteSpeed also reads it. Nginx has no per directory config file, so the same redirects have to be written as location and rewrite directives inside the server block and then reloaded by an administrator.