.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.
.htaccess Generator
Create Apache .htaccess rules for redirects, HTTPS, security headers and access control.
How to Use This Tool
Configure HTTPS Redirects
Toggle options to force SSL/HTTPS or manage www subdomain redirections.
Define Access Restrictions
Optionally add specific IP block lists, disable directory browsing, or block specific hotlinking referrers.
Enable Security Headers
Select options to inject security headers such as X-Frame-Options or X-Content-Type-Options.
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.