Warning WARNING: Editing the .htaccess file incorrectly can break your website. Always back up your existing .htaccess file before making any changes. This tool operates client-side; you must manually copy and apply the changes to your server. WWW Redirection Redirect Type: Do not redirect WWW Redirect non-WWW to WWW (e.g., example.com to www.example.com) Redirect WWW to non-WWW (e.g., www.example.com to example.com) Your Domain Name (e.g., example.com): Enter your root domain. Do NOT include http:// or www. 301 Redirect (Permanent) What to redirect: Specific File Entire Directory Custom Path (using RewriteRule) Old Path (e.g., /old-page.html or /old-directory/): New Path (e.g., /new-page.html or /new-directory/): Browser Caching (Expires Headers) Enable caching for specific file types File Extensions to Cache (comma separated): Omit leading "." (e.g., `css, js, jpg`). Cache Duration: Unit: MinutesHoursDaysWeeksMonths Cache Type: Public (shared cache) Private (browser cache only) Require revalidation on each visit Forces browser to revalidate cached content with server. Password Protect Enable password protection Authentication Area Name (e.g., "My Restricted Section"): .htpasswd File Path (e.g., /home/user/.htpasswd): Absolute path to your .htpasswd file. This file must be outside your web root for security. Prevent Hotlinking Enable hotlinking prevention Your Domain Name (e.g., example.com): Enter your domain name to allow hotlinking from your own site. Image Extensions to Protect (comma separated): Omit leading "." (e.g., `jpg, png`). URL of No Hotlinking Image (Optional): URL to an image that will be shown instead of the hotlinked one. Custom Error Pages 400 (Bad Request) Error Page Path: 401 (Auth Required) Error Page Path: 403 (Forbidden) Error Page Path: 404 (Not Found) Error Page Path: 500 (Internal Server Error) Error Page Path: Enter the paths to your custom error pages, relative to your web root (e.g., /errors/404.html). Leave blank to use server defaults. IP Restriction (Block or Allow) IP Addresses to BLOCK (comma or newline separated): List IPs or IP ranges to deny access. Example: `1.2.3.4`, `1.2.3.0/24`. IP Addresses to ALLOW (comma or newline separated): List IPs or IP ranges to grant access. Only use with "Deny from all" or "Require all denied". Restriction Mode: Block specific IPs (and allow all others) Allow specific IPs (and block all others)If blocking, allow all by default, then deny listed. If allowing, deny all by default, then allow listed. Combining both requires careful configuration. Block Unwanted Bots / User-Agents Enable blocking unwanted user-agents User-Agents to Block (comma or newline separated): Enter parts of user-agent strings to block. Case-insensitive. Change Default Directory Page Change default index file New Default Directory Page Name: E.g., `myindex.html`, `home.php`. Overrides `index.html`, `index.php`. Prevent Viewing of .htaccess File Deny access to .htaccess and other dot files Highly recommended for security. Prevents browsers from accessing files starting with a dot. Prevent Directory Listing Disable automatic directory indexing Prevents visitors from seeing a list of files in directories without an index file (e.g., index.html). Highly recommended. Your .htaccess Content: This area will display the generated .htaccess code. You can also paste your existing .htaccess content here for formatting or minification. Go to Top Bookmark this tool