Htaccess Generator
The .htaccess file is a directory-level configuration file for Apache web servers. Use this generator to visually build common htaccess rules — force HTTPS, set up redirects, block IPs, configure custom error pages, and more — without writing a single line by hand.
Redirect all HTTP requests to HTTPS.
Prevent visitors from seeing a list of files in a directory.
Generated .htaccess
# Select rules above to generate your .htaccess code
Common Presets
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Redirect 301 /old-page https://example.com/new-page
<RequireAll> Require all granted Require not ip 192.168.1.100 </RequireAll>
Options -Indexes
How to Use
Toggle Rules
Use the checkboxes above to enable the rules you need. Fill in any required parameters.
Review Output
The generated .htaccess code updates in real-time. Review it to make sure it looks correct.
Copy & Deploy
Click "Copy All" and paste the code into your .htaccess file on your Apache server. Always back up your existing file first.
Frequently Asked Questions
.htaccess is a configuration file used by Apache web servers. It allows you to set rules for URL redirection, access control, custom error pages, and more — all at the directory level without modifying the main server config.
No. .htaccess files are specific to Apache servers. Nginx uses a different configuration format. This tool is designed exclusively for Apache.
Yes. Enable the "Force HTTPS" rule in this generator, and it will produce the correct RewriteRule to redirect all HTTP requests to HTTPS.
Use the "301 Redirect" section. Enter the old path and the new URL, and the generator will create a proper 301 redirect rule.
No. The generated code is meant to be added to your existing .htaccess file. Always review and merge rules carefully to avoid conflicts.
Yes, completely free with no account required.
Explore More Tools
DevToolHub offers a growing collection of free, fast, modern online tools for developers and creators.
Browse All Tools