🔒 HTTPS & WWW Settings

↪️ 301 Redirects

Format: /old-path /new-path (one redirect per line)

🚨 Custom Error Pages

📁 Directory Settings

Space-separated list of default files

⚡ Performance

🛡️ Security

📄

Bulk Mode Not Available

The .htaccess Generator creates a single configuration file for your website. Bulk generation is not applicable for this tool.

Please use the Tool tab to generate your .htaccess file.

Quick Start

How to Generate a .htaccess File

  1. Select Features: Choose the features you want to enable (HTTPS, redirects, security, etc.)
  2. Configure Settings: Fill in any required fields (domain names, redirect paths, error pages)
  3. Click Generate: Click the "Generate .htaccess File" button
  4. Download or Copy: Download the file or copy the code
  5. Upload: Upload the .htaccess file to your website's root directory

Features Explained

HTTPS & WWW Settings

Force HTTPS Automatically redirects all HTTP traffic to HTTPS Improves security and SEO rankings Required if you have an SSL certificate WWW Redirect Add WWW: Redirects example.com to www.example.com Remove WWW: Redirects www.example.com to example.com Helps consolidate your SEO and avoid duplicate content penalties Choose one consistent version for your site

301 Redirects

Permanent redirects for moved or renamed pages:
Format: /old-url /new-url (one per line) Example: /old-page.html /new-page.html Preserves SEO value from old URLs Returns 301 status code (permanent redirect) Use Cases: Page has moved to a new location URL structure has changed Consolidating multiple pages into one Fixing broken links

Custom Error Pages

Create custom error pages for better user experience:
404 Error: Page not found 500 Error: Internal server error Best Practices: Create user-friendly error pages Include navigation links Add a search box Provide helpful suggestions

Directory Settings

Default Index Files
Specifies which file to serve when accessing a directory Common: index.html index.php default.html Server checks files in order listed Disable Directory Browsing Prevents visitors from seeing folder contents Highly recommended for security Hides file structure from potential attackers

Performance

GZIP Compression
Compresses text files before sending to browser Reduces bandwidth usage by 50-70% Faster page load times Compresses: HTML, CSS, JavaScript, XML Benefits: Improved page speed Better user experience Lower hosting costs Higher SEO rankings

Security

Block Bad Bots
Blocks common scrapers and malicious bots Reduces server load Protects content from theft Blocks: Ahrefs, SEMrush, MJ12bot, and others Hotlink Protection Prevents other sites from embedding your images Saves bandwidth Protects copyrighted content Enter your domain (e.g., example.com)

Installation Instructions

Step 1: Backup Existing .htaccess

Before uploading, always backup your current .htaccess file:
  1. Connect via FTP or File Manager
  2. Navigate to your website root (usually public_html or www)
  3. Download existing .htaccess if present
  4. Keep a copy in safe location

Step 2: Upload New .htaccess

Via FTP:
  1. Connect to your server
  2. Navigate to root directory
  3. Upload the generated .htaccess file
  4. Set permissions to 644
Via cPanel File Manager:
  1. Log into cPanel
  2. Open File Manager
  3. Navigate to public_html
  4. Upload or create new .htaccess file
  5. Paste generated code
Via SSH: ```bash nano .htaccess

Paste generated code

Save with Ctrl+X, then Y

chmod 644 .htaccess ```

Step 3: Test Your Website

After uploading:
  1. Visit your website in incognito/private mode
  2. Test all redirects
  3. Check error pages
  4. Verify HTTPS is working
  5. Test on multiple browsers

Step 4: Monitor for Issues

Check server error logs Monitor Google Search Console Test with SSL checker tools Verify all pages load correctly

Common Use Cases

Basic Website Security Setup

Enable:
✅ Force HTTPS ✅ Remove WWW (or Add WWW) ✅ Disable Directory Browsing ✅ Block Bad Bots

E-commerce Website

Enable:
✅ Force HTTPS (required) ✅ Custom Error Pages ✅ GZIP Compression ✅ Hotlink Protection ✅ Security Headers

Blog or Content Site

Enable: ✅ Force HTTPS ✅ WWW Redirect ✅ 301 Redirects (for updated URLs) ✅ GZIP Compression ✅ Block Bad Bots

Portfolio or Landing Page

Enable:
✅ Force HTTPS ✅ Custom Error Pages ✅ Hotlink Protection ✅ Disable Directory Browsing

Troubleshooting

Q: I get a 500 Internal Server Error after uploading

A: Your .htaccess file has a syntax error or your server doesn't support a directive. Remove the .htaccess file temporarily, then add directives one by one to identify the issue.

Q: My redirects aren't working

A: Make sure mod_rewrite is enabled on your server. Contact your hosting provider if needed. Also verify the redirect paths are correct.

Q: GZIP compression isn't working

A: Your server may not have mod_deflate enabled. Check with your hosting provider or try alternative compression methods.

Q: I can't find the .htaccess file

A: Files starting with a dot (.) are hidden by default. Enable "Show Hidden Files" in your FTP client or File Manager.

Q: Changes aren't taking effect

A: Clear your browser cache and server cache. Some changes may require a few minutes to propagate.

Q: Can I use multiple .htaccess files?

A: Yes, you can place .htaccess files in subdirectories. Rules cascade from parent to child directories.

Best Practices

  1. Always Backup: Keep a copy of your working .htaccess file
  2. Test on Staging: Test changes on a staging site first
  3. Use Comments: Add comments to document custom changes
  4. Keep it Simple: Only add rules you actually need
  5. Monitor Performance: Check load times after enabling compression
  6. Regular Updates: Review and update redirects periodically
  7. Security First: Always enable security features
  8. Valid Syntax: Use a validator to check your .htaccess code

File Permissions

Recommended .htaccess file permissions:
644: Owner can read/write, group and others can read only Never use 777: This is a security risk Set permissions via FTP or SSH: ```bash chmod 644 .htaccess ```

Apache Modules Required

Common modules used:
mod_rewrite: URL rewriting and redirects mod_deflate: GZIP compression mod_headers: Security headers mod_expires: Browser caching Check if a module is enabled: ```bash apache2ctl -M | grep rewrite ```

Security Warnings

⚠️ Important Security Notes:
Never expose sensitive files via .htaccess Don't use .htaccess to store passwords Keep .htaccess file permissions at 644 Regularly review and update security rules Monitor server logs for suspicious activity

Additional Resources

Apache .htaccess Documentation mod_rewrite Guide SEO Best Practices for Redirects Website Security Checklist

Usage Limits

Plan Daily Limit Best For
Free (Current) 100 uses/day Personal use
Basic 1000 uses/day Regular use
Gold 10000 uses/day Power users
Ultimate Unlimited Unlimited access