.htaccess Generator Online — Create Apache Server Configuration

Free professional .htaccess file generator for the Apache web server: HTTPS redirects, WWW rules, 301 forwarding, WordPress protection, IP blocking, browser caching, gzip compression, and more

.htaccess File Generator
Apache 2.4+ 15 rules Safe
Settings Select rules
Redirects
Security
Speed
🛠️ Technical
Generated Code
⚙️

Select rules and click "Generate"

Rule Categories
Redirects and Forwarding

Automatically redirect visitors from one address to another. Essential for site migrations, domain changes, or enforcing a unified URL format.

Rules:
  • HTTP → HTTPS — redirect all visitors to the secure version of the site
  • WWW → non-WWW — remove www from the address (example.com instead of www.example.com)
  • non-WWW → WWW — add www to the address for a unified format
  • 301 redirect — permanent redirect from an old page to a new one
  • Redirect index.php — hide index.php from the URL
Security and Site Protection

Rules to protect your site from attackers, bots, and unauthorized access. Enhance security and stability.

Rules:
  • Block IP addresses — deny access for specific IPs
  • Protect wp-admin — restrict access to the WordPress admin panel
  • Protect wp-config.php — deny access to the configuration file
  • Disable directory listing — hide file lists in directories
  • Hotlink protection — prevent other sites from using your images
  • Block malicious bots — protect from unwanted scanners
Speed and Performance

Settings to speed up site loading through browser file caching and data compression before transfer.

Rules:
  • Browser Caching — save files in the browser for a set period
  • Gzip compression — compress HTML, CSS, JS files for faster transfer
  • Image caching — cache images in the browser for 1 month
  • Style and script caching — cache CSS and JavaScript files
  • ETag removal — optimize cache validation
🛠️ Technical Settings

Special server parameters: PHP settings, error pages, encoding, and other technical options for webmasters.

Rules:
  • Custom error pages — custom pages for 404, 403, 500 errors
  • UTF-8 encoding — proper display of international characters
  • PHP settings — increase memory limits and execution time
  • Disable register_globals — improve PHP security
  • Force download for files — force download of certain file types
Ready-made Configurations
🌐 Basic Settings for a Business Card Site

Minimal set of rules for a simple informational website or landing page.

Includes:
  • HTTPS redirect for security
  • WWW redirect for unified format
  • Basic file caching
  • Gzip compression for speed
  • Custom 404 page
🛒 E-commerce Store Configuration

Extended rules for an e-commerce site with enhanced security and speed optimization.

Includes:
  • Forced HTTPS for the entire site
  • Image hotlink protection
  • Maximum caching of static files
  • Suspicious User-Agent blocking
  • Admin panel protection
  • Gzip optimization for large files
📰 WordPress Optimization

Specialized rules for WordPress sites: blogs, news portals, corporate websites.

Includes:
  • wp-config.php and wp-admin protection
  • Hide WordPress version
  • Block XML-RPC attacks
  • WordPress file caching
  • Brute force protection for wp-login.php
  • Clean URLs for WordPress without index.php
FAQ
What is an .htaccess file and why is it needed?

.htaccess (hypertext access) is a configuration file for the Apache web server. It allows you to configure site behavior without access to the main server config: create redirects, protect directories, optimize loading speed.

Where should I place the generated .htaccess file?

Upload the file to the root directory of your site (where index.php or index.html is located). This is usually the public_html, www, or httpdocs folder on your hosting. The file must be named exactly .htaccess (with a dot at the beginning).

Does .htaccess work on any hosting?

.htaccess only works on the Apache web server. If your hosting uses Nginx, different configuration files are needed. Most shared hosting providers use Apache and support .htaccess.

What should I do if the site breaks after uploading .htaccess?

If a 500 Internal Server Error appears after uploading .htaccess, delete or rename the file via FTP. Check that all rules are supported by your hosting. Add rules gradually, checking functionality after each addition.

How do I verify that .htaccess is working?

The simplest way is to add a test redirect or access denial rule. If the rule takes effect, .htaccess is working. You can also add an intentional error to the file — if a 500 error appears, the file is being processed by the server.

Can I combine different rules in one file?

Yes, you can combine an unlimited number of rules in a single .htaccess. Use our generator to select all the settings you need at once — they will automatically be merged into one file in the correct order.

.htaccess Generator — Create Apache Server Configuration Without Coding

Free professional online .htaccess file generator for the Apache web server without needing to know complex syntax. Create rules for HTTP to HTTPS redirects, WWW settings, 301 forwarding, WordPress site protection, IP blocking, browser caching optimization, gzip compression, and other important settings to improve your site's security and loading speed.

What is an .htaccess File and Why It Matters

The .htaccess file as your site's configuration center is a powerful tool for managing Apache web server behavior without needing access to the main server configuration. The name .htaccess stands for "hypertext access." This file allows webmasters and site owners to set up redirects, password-protect directories, block unwanted visitors, optimize loading speed through caching and compression, and configure server error handling — all without contacting your hosting administrator or having root server access.

Benefits of using .htaccess for websites include the ability to quickly implement changes without restarting the web server, flexible behavior settings for individual directories, enhanced security through access restrictions and confidential file protection, improved SEO through proper 301 redirects and clean URLs, and faster loading through browser caching and gzip compression. The vast majority of shared hosting providers use the Apache web server, making .htaccess knowledge critically important for web developers and SEO specialists.

Use our professional .htaccess generator for quick Apache server configuration file creation. The tool ensures correct syntax, supports all modern Apache versions, and is optimized for use by both beginners and experienced web developers.

Related calculators

Disclaimer: all calculations on this site are approximate and provided for informational purposes. Results may differ from actual depending on individual conditions, technical specifications, region, legislative changes, etc.

Financial, medical, construction, utility, automotive, mathematical, educational and IT calculators are not professional advice and cannot be the sole basis for making important decisions. For accurate calculations and advice, we recommend consulting with specialized professionals.

The site administration bears no responsibility for possible errors or damages related to the use of calculation results.