Skip to content
OneKitly

Htaccess redirect generator

Generate ready-to-paste Apache .htaccess rules for the common jobs: 301/302 redirects (single or regex), forcing HTTPS, forcing www or non-www, blocking IP addresses, removing trailing slashes, image hotlink protection and GZIP compression. Pick a rule, fill the blanks and copy — remember to back up your .htaccess first.

Htaccess redirect generator is free to use as often as you like, directly from this page. It covers 301/302 redirects (single or regex), forcing HTTPS, forcing www or non-www, blocking IP addresses, removing trailing slashes, image hotlink protection and GZIP compression. Pick a rule, fill the blanks and copy — remember to back up your .htaccess first — adjust any of them and the result follows immediately.

How to use it

  1. Open the tool — no signup or install needed.
  2. Enter your input or adjust the available options.
  3. Get your result instantly, then copy or download it.

Frequently asked questions

What does Htaccess redirect generator do?

Generate ready-to-paste Apache .htaccess rules for the common jobs: 301/302 redirects (single or regex), forcing HTTPS, forcing www or non-www, blocking IP addresses, removing trailing slashes, image hotlink protection and GZIP compression. Pick a rule, fill the blanks and copy — remember to back up your .htaccess first.

What does a concrete case look like?

Redirect 301 /old-page /new-page — the tool shows every step in between, not just the final figure.

What does it take into account?

It factors in 301/302 redirects (single or regex), forcing HTTPS, forcing www or non-www, blocking IP addresses, removing trailing slashes, image hotlink protection and GZIP compression. Pick a rule, fill the blanks and copy — remember to back up your .htaccess first. Change any of them and the output follows immediately.

When would I actually use this?

Getting usable data out of something that was never meant to be parsed: pulling every address out of a pasted thread, turning a column of lines into a JSON array or an SQL IN clause, renaming a hundred identifiers from snake_case to camelCase in one pass.

What is the most common mistake?

Trusting an extraction to be exhaustive. A pattern that catches every address in the sample will still miss the one wrapped across a line break, the one written with a display name, and the one an email client turned into a link — count what came out against what you expected before you use the list.

What else is filed next to it?

Flip Image, HTTP Status Code Reference and My IP address share its section. They are not variants of it — being filed together is not the same as being alike — but that is where to look if this turned out not to be the tool you wanted.

Where do the figures come from?

Extraction runs on patterns, not on a parser: it recognises the common shapes of an address, a URL or an IP rather than validating them against their specification. That is the right trade for a paste, and the wrong one for input you are about to store.

Further reading

All guides
GuideHTTP Status Codes Explained: The Ones That Actually Get Confused301 against 308, 302 against 307, 401 against 403, 404 against 410 — plus what Retry-After on a 429 or a 503 actually promises. The pairs where picking the wrong code changes behaviour, not just wording.How-toHow to Write a Cron Expression: Five Fields and the OR Rule Nobody MentionsMinute, hour, day of month, month, day of week. The traps are that a step is a stride through a range and not an interval, and that the two day fields are combined with OR — so 0 0 1 * 1 fires on the 1st and on every Monday.ExplainerHow Unix File Permissions Work: Reading 755 Without GuessingRead is 4, write is 2, execute is 1, and each of the three digits describes a different party. The part most explanations get wrong is what the execute bit does on a directory — it grants traversal, not the right to run anything.How-toHow to Write a robots.txt: Directives, Matching, and What It Cannot HideFour directives, two wildcards, one file at the host root. It is a crawl instruction and nothing more — it does not remove a page from search results, it does not restrict access, and it publishes every path you list in it.ExplainerHow Subnet Masks Work: CIDR, Network Bits, and Usable HostsUnderstand how a subnet mask splits an IP address into network and host parts, what /24 means, and how to count usable hosts.How-toHow to Read Binary and Convert It to Decimal and HexLearn how binary place values work and convert binary to decimal and hexadecimal by hand, with clear worked examples.