Apache .htaccess guide: what it is, how to use this generator, and when each feature applies
This page explains Apache per-directory configuration, walks through the CSV redirect plan and the full htaccess file generator above, and links to official Apache HTTP Server documentation so you can verify directives on your stack.
What is an Apache .htaccess file?
On the Apache HTTP Server, a file named
.htaccess is a
per-directory configuration file. When allowed by
the server, Apache reads it for each request that maps to that
directory (and often its subdirectories), applying directives such
as URL rewriting, redirects, access control, and response headers
without editing the main server config.
Whether a given directive works from
.htaccess depends on
AllowOverride: the server must permit the
directive class (for example FileInfo for many
RewriteRule uses, or AuthConfig
for IP Require rules). The
output of this generator includes comments that echo those
requirements so you can align them with your host or VirtualHost.
Official reference: Apache 2.4: .htaccess files.
How to use this online tool
You can generate htaccess file online entirely in
your browser: there is no upload step and no server-side
processing of your CSV or options. Use the steps below, then copy
the output into a file named
.htaccess on your site (after
testing).
- Choose a mode. Use CSV redirect plan for spreadsheet-style mappings, or Full .htaccess generator to combine HTTPS, caching, IP rules, and more in one file.
- Paste your data and set options. Toggle skip first row if the first line is a header row. In full mode, open each collapsible section as needed (for example HTTPS and simple redirects first, then security, errors, cache, and access control).
- Review messages under the form if a row or option needs a fix (for example empty IP list while IP mode is on).
- Copy the generated snippet with the Copy button, deploy to staging or a local Apache mirror, and verify redirects and error paths before production.
CSV redirect plan (apache htaccess redirect generator)
The CSV to .htaccess side of this app is an
htaccess 301 redirect generator at heart: each
row becomes one or more
RewriteRule
lines wrapped in
mod_rewrite, using the response
code per row or the Default R= field when the
third column is empty (the field starts at 301).
Columns and delimiters
The parser detects the delimiter from the first non-empty line. Accepted delimiters are semicolon, comma, or tab.
- Column 1 (from): Source URL or path (may include a hostname).
-
Column 2 (to): Target URL or path. Absolute
http(s)://targets stay absolute in the rule; path-only targets stay path-only, with domain inferred from earlier rows when needed. -
Column 3 (optional): Value for the
RewriteRuleredirect flagR=: a three-digit HTTP status (for example302) or an Apache symbolic name such aspermanent,temp, orseeother. If omitted or blank, the Default R= control above the editor is used; if that is empty too, the generator falls back to 301.
Path wildcard (not a full regex UI)
If the from path ends with
*, the generator emits
two
RewriteRule lines: one for the
exact prefix path and one for all nested paths. This is practical
for bulk moves of a section of a site. It is
not a general-purpose htaccess regex generator:
arbitrary Perl-compatible patterns are not entered field-by-field;
edit the file manually if you need custom pattern logic.
| From cell | To cell | Status (optional) |
|---|---|---|
/old-page |
/new-page |
(uses Default R=, 301 out of the box) |
https://shop.example/en/*
|
https://shop.example/us/
|
301 |
Full .htaccess file generator features
The full .htaccess generator assembles optional
blocks in a sensible order: core options and error documents, IP
access, simple Redirect lines,
the mod_rewrite section (HTTPS,
canonical host, hotlink, User-Agent blocks, and appended CSV
rules), then cache headers. Every block is guarded by the
appropriate
<IfModule> where relevant.
Rewrite / HTTPS / canonical host
- Force HTTPS: issues a 301 to the HTTPS URL when TLS is off.
-
Canonical host: choose www or
apex (strip or add
www) with redirect flags. -
RewriteBase: optional explicit
RewriteBasewhen your directory layout requires it. -
Append CSV redirects: merges the CSV plan into
the same
mod_rewriteblock without clearing your spreadsheet when you switch modes.
Simple redirects
The “simple redirects” textarea maps pairs to
Redirect directives emitted by
Apache’s mod_alias module
(default 301), including a numeric-status plus
path form if you prefix a line with a status code. That suits a
short list of literal path moves alongside the bulk CSV rules.
Hotlink protection and User-Agent blocking
-
Hotlink: optional
RewriteCondonRefererand one rule over selected extensions; can return403or a placeholder URL. -
Block User-Agent: each non-empty line becomes a
pattern in
RewriteCond %{HTTP_USER_AGENT}; broad patterns can block legitimate traffic, so refine with care.
IP allowlist and blocklist
With mod_authz_core, choose
allow only listed IPs (deny others) or
deny listed IPs (grant others). CIDR and plain
addresses can be separated by comma or newline. The generator
refuses to emit an empty list when a mode is active, so you do not
publish a destructive half-config by mistake.
Core and hardening
Mostly mod_core options, error
documents, and small hardening toggles before the rewrite block.
-
Directory indexes:
Options -Indexesto turn off directory listings. - DirectoryIndex: one or more default filenames for directory requests.
- ErrorDocument: paths for HTTP 400, 401, 403, 404, and 500 responses.
-
Protect .htaccess: deny direct access to the
file via
Require all deniedon.htaccess. -
Block .git:
RedirectMatch 403for.gitexposure.
Caching
With mod_headers, supply file
extensions and a positive max-age in seconds; the
output sets
Cache-Control: public,max-age=…
via Header set on matching
files. If extensions are set without a valid max-age, the UI
reminds you to set one.
301 redirect SEO: what an .htaccess generator can (and cannot) fix
Search engines treat 301 Moved Permanently as the strong signal that a URL has a durable new location. This tool helps you generate htaccess redirect rules consistently from a spreadsheet so large migrations and routine URL cleanup stay auditable.
Good technical SEO also means avoiding redirect chains (A→B→C), preserving the right hostname with HTTPS, and testing with curl or your browser network panel. No .htaccess file generator can guarantee rankings; it only helps you publish correct HTTP-level behavior.
Generate new htaccess file WordPress or PrestaShop context
For WordPress, the primary
.htaccess usually lives in the
document root next to index.php.
WordPress already ships a
mod_rewrite block for pretty
permalinks. Add custom rules outside that block
or in the exact order your host documents - never break the core
RewriteBase / index scaffolding
without testing on staging.
For PrestaShop, the location is again typically the shop root; versions and hosting panels vary, so confirm with your provider before replacing a whole file. This app is Apache 2.4 oriented, not a CMS-specific wizard: it outputs standard directives you merge into your real configuration.
Pitfalls, AllowOverride, and testing
- A syntax mistake can return 500 errors for the entire directory - deploy during a maintenance window when unsure.
-
mod_rewritemust be available, andAllowOverridemust allow the directive categories your snippet uses (the generated comments name those categories). - Rewrite interaction with frameworks (Laravel front controller, Node reverse proxy, etc.) often requires expert ordering; use this tool as a starting point, then adjust.
What this tool does not generate
Searches for an htaccess and htpasswd generator
often expect HTTP Basic authentication.
This project never writes password hashes or
builds the contents of an
htpasswd file. In
full mode, you can optionally include an HTTP
Basic (file provider) template: you enter the
absolute server path for
AuthUserFile, and the output
adds AuthType /
Require valid-user plus
commented htpasswd examples.
You still create the password file on the server. Official
references:
htpasswd program,
Authentication and authorization.
Learn more (official Apache documentation)
For authoritative behavior and module availability, prefer the HTTP Server documentation over third-party copies:
Frequently asked questions
Is this Apache .htaccess generator free and does it run online?
Yes. The tool is free to use in your browser. Nothing is uploaded to a server; rules are built locally on your device.
Does my CSV or generated file get sent over the network?
No. All parsing and generation run client-side in JavaScript. Your data stays in the page unless you copy it elsewhere yourself.
Which delimiters work in the CSV redirect plan?
The first non-empty line of your paste is scanned for a delimiter. Accepted delimiters are semicolon, comma, or tab.
What is the default HTTP redirect status?
If the third column is missing or blank, rows use the Default R= value in the redirect plan (initially 301). You can change that field or set a per-row status in the third column (numeric code or Apache symbolic name).
Can I redirect an entire path prefix with one row?
Put an asterisk at the end of the from path (first column). The tool emits two RewriteRule lines so both the exact path and everything under it redirect.
Does this tool create htpasswd files or HTTP Basic authentication?
It never creates password file contents or handles passwords. In
full mode you can optionally add an HTTP Basic template: you
provide the absolute
AuthUserFile path on your
server, and the output includes commented
htpasswd examples. Use the
official Apache authentication documentation and the
htpasswd utility on the server
to build the actual password file.
How do I force HTTPS or a canonical www host?
Open the full generator mode and enable Force HTTPS and pick Canonical host for www or apex. The output wraps rules in an IfModule mod_rewrite.c block.
Can I block scrapers or hotlinking of images?
Yes in full mode. User-Agent patterns are turned into RewriteCond lines ending in 403, and optional hotlink rules use the Referer header with configurable file extensions.
Is this an htaccess regex generator for arbitrary patterns?
No. CSV rows become literal path-based RewriteRule patterns plus an optional trailing wildcard. For fully custom regex you still hand-edit Apache directives with care.
Where should .htaccess live for WordPress?
Typically in your site root next to the WordPress index.php file. Keep the WordPress core rewrite block untouched and add snippets above or below per your host guidance, then test on staging.