.htaccess Generator
Generate an Apache .htaccess file with HTTPS redirects, www rules, caching headers, and custom error pages.
This document is a template for informational purposes only and does not constitute legal advice. Consult a qualified attorney for your specific needs.
Did this tool work for you?
How to use this calculator
- 1
Select your HTTPS and www preferences and enter your domain name.
- 2
Toggle browser caching and Gzip compression on or off.
- 3
Choose whether to prevent image hotlinking and disable directory listing.
- 4
Select a PHP version hint if needed.
- 5
Copy or download the .htaccess file and upload it to your website's root directory.
Frequently asked questions
What is an .htaccess file?
An .htaccess (hypertext access) file is a configuration file for Apache web servers. It lets you set URL redirects, enable compression, configure caching, block directories, set custom error pages, and more — all at the directory level without editing server config files.
Where do I upload the .htaccess file?
Upload it to your website's root directory (usually /public_html/ or /www/) via FTP or your hosting control panel's file manager. The file must be named exactly ".htaccess" with no other extension.
Will this work on Nginx or other servers?
No — .htaccess files are specific to Apache web servers. Nginx uses server block configuration files instead. Most shared hosting (cPanel, Plesk) runs Apache and supports .htaccess.
Can a wrong .htaccess file break my site?
Yes — a syntax error in .htaccess returns a 500 Internal Server Error for all visitors. Always keep a backup of your current .htaccess before replacing it. Most hosting providers let you restore via cPanel.
Free .htaccess Generator
Why .htaccess matters for SEO
A properly configured .htaccess file directly impacts your SEO. HTTPS redirects ensure Google indexes your secure version. www/non-www canonicalisation prevents duplicate content penalties. Browser caching improves page speed, a confirmed Google ranking factor. Getting these right in .htaccess is faster and more reliable than plugin-based solutions.
Most important .htaccess rules
The three most important rules for any website are: (1) Force HTTPS — Google has required HTTPS since 2014 and marks HTTP sites as "Not secure". (2) www canonicalisation — pick one version and redirect the other consistently. (3) Enable Gzip — reduces page size by 60–80%, directly improving Core Web Vitals scores.
Learn more from an authoritative source:
MDN Web DocsJSON Formatter & Validator
Format, validate, and minify JSON — with clear error messages for invalid input.
Base64 Encoder / Decoder
Encode plain text to Base64 or decode Base64 strings back to readable text.
URL Encoder / Decoder
Encode special characters in URLs (percent-encoding) or decode percent-encoded URLs.
UUID Generator
Generate UUID v4 (random) identifiers — one or in bulk.
Unix Timestamp Converter
Convert Unix timestamps to human-readable dates and times, and vice versa.
JWT Decoder
Decode and inspect JWT (JSON Web Token) headers and payloads without verifying the signature.
Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →