.htaccess Generator Online Free

Create customized Apache .htaccess configuration files. Generate directive templates to enforce HTTPS redirections, block specific IP blocks, prevent directory listing, and inject custom security headers.

✓ Free security tool✓ No signup required✓ Fast results✓ Browser-based utility✓ Mobile friendly
🔒Privacy Note: This tool runs in your browser and does not upload data to BuBird servers.
⚠️Deployment Notice: The rules generated by this tool are standard configuration templates. Always review and validate directives on a staging system before adding them to live production Apache servers.
Security Tools
.htaccess Generator
⚙️

.htaccess Generator

Create Apache .htaccess rules for redirects, HTTPS, security headers and access control.

Rules to Include
Force HTTPS
Redirect all HTTP to HTTPS
Redirect www → non-www
Canonical domain without www
Disable directory listing
Hide folder contents
Block sensitive files
.env, .sql, .key files
Security headers
X-Frame, XSS, Content-Type
Enable GZIP compression
Faster page loads
Browser caching
Cache static assets
Prevent hotlinking
Block direct image linking
Generated .htaccess
# Generated .htaccess # Force HTTPS RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # Redirect www → non-www RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] # Disable directory listing Options -Indexes # Block sensitive files <FilesMatch "\.(env|log|sql|bak|conf|key|pem)$"> Deny from all </FilesMatch> # Security headers Header set X-Frame-Options "SAMEORIGIN" Header set X-XSS-Protection "1; mode=block" Header set X-Content-Type-Options "nosniff" Header set Referrer-Policy "no-referrer-when-downgrade"

How to Use This Tool

1

Configure HTTPS Redirects

Toggle options to force SSL/HTTPS or manage www subdomain redirections.

2

Define Access Restrictions

Optionally add specific IP block lists, disable directory browsing, or block specific hotlinking referrers.

3

Enable Security Headers

Select options to inject security headers such as X-Frame-Options or X-Content-Type-Options.

4

Copy & Deploy Rules

Copy the generated config text, paste it into a file named '.htaccess' in your root server directory, and test.

Forcing HTTPS redirection for a corporate site

You want to redirect all HTTP traffic to HTTPS automatically. Toggle the 'Force HTTPS' option. The tool generates: 'RewriteEngine On \n RewriteCond %{HTTPS} off \n RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]', which you place in your .htaccess file.

Common Use Cases

Apache Redirections

Manage 301 permanent redirects and www/non-www domain routing.

Security Hardening

Enforce HTTPS, disable directory listings, and block spam bots or referral sites.

IP Access Control

Block specific malicious IP ranges or allow access only to staging administrative networks.

Server Administration

Understand RewriteRules, RewriteConditions, and Apache modular configs.

Related Security Tools

Frequently Asked Questions

What is an Apache .htaccess file?
.htaccess (hypertext access) is a configuration file used by Apache web servers to manage directory-level configuration, including cache settings, redirects, and URL rewrites.
Should I test these directives before placing them on my live site?
Yes. Misconfigured directives in an .htaccess file can cause '500 Internal Server Error' alerts. You must test generated rules on a staging server before deploying to production.
Are my server configuration parameters uploaded?
No. The configuration calculation runs locally in your browser using JavaScript and does not upload your settings.