.htaccess Generator

Create professional Apache .htaccess files with ease. Generate redirects, security rules, performance optimizations, and more with our comprehensive web server configuration tool.

How to Use This Tool

1. Select the type of rule you want to create using the tabs below
2. Fill in the required information for each rule type
3. Click "Add Rule" to include it in your .htaccess file
4. Review the generated code in the output section
5. Copy the code and save it as ".htaccess" in your website's root directory

Important: Always backup your existing .htaccess file before making changes. Test rules on a staging site first.

URL Redirects

Enter the old URL path (starting with /)
Enter the new URL (can be relative or absolute)

Security Rules

Required for hotlinking protection feature

Performance Optimization

URL Rewrites

Custom Rewrite Rule

Regular expression pattern to match
Where to rewrite the URL to
Rewrite flags (L=Last, QSA=Query String Append)

Access Control

IP Address Control

Enter single IP or IP range (e.g., 192.168.1.0/24)

Password Protection

File Access Control

Specify file patterns to protect (e.g., *.txt, .env, *.log)

Custom Error Pages

Path to your custom error page

Generated .htaccess Code