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

Force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Redirect Old Page
Redirect 301 /old-page https://example.com/new-page
Block IP
<RequireAll>
  Require all granted
  Require not ip 192.168.1.100
</RequireAll>
Disable Directory Listing
Options -Indexes

How to Use

1

Toggle Rules

Use the checkboxes above to enable the rules you need. Fill in any required parameters.

2

Review Output

The generated .htaccess code updates in real-time. Review it to make sure it looks correct.

3

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

What is .htaccess?

.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.

Does this work on Nginx?

No. .htaccess files are specific to Apache servers. Nginx uses a different configuration format. This tool is designed exclusively for Apache.

Can I force HTTPS with htaccess?

Yes. Enable the "Force HTTPS" rule in this generator, and it will produce the correct RewriteRule to redirect all HTTP requests to HTTPS.

How do I redirect an old URL?

Use the "301 Redirect" section. Enter the old path and the new URL, and the generator will create a proper 301 redirect rule.

Will this overwrite my existing rules?

No. The generated code is meant to be added to your existing .htaccess file. Always review and merge rules carefully to avoid conflicts.

Is this htaccess generator free?

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