Build Apache .htaccess rules visually — toggle rules and see the output instantly.
Rules
REDIRECTS
Redirect HTTP to HTTPS
Force all traffic to use HTTPS
WWW to Non-WWW
Redirect www.example.com → example.com
Non-WWW to WWW
Redirect example.com → www.example.com
Custom URL Redirect (301)
Permanently redirect one URL to another
Force Trailing Slash
Redirect /page → /page/
Remove .html Extension
Serve /about.html as /about
ERROR PAGES
Custom 404 Error Page
Show a custom page for 404 Not Found errors
Custom 500 Error Page
Show a custom page for 500 Server errors
SECURITY
Prevent Directory Listing
Hide file listings when no index file exists
Protect .htaccess File
Block direct HTTP access to .htaccess
Block Bad Bots
Block common scrapers and bad crawlers
Password Protect Directory
Require HTTP Basic Auth to access this directory
Block IP Address
Deny access from a specific IP address
PERFORMANCE
Browser Caching
Set cache headers for static assets
Enable Gzip Compression
Compress text assets with mod_deflate
Generated .htaccess
The .htaccess file (hypertext access) is a directory-level configuration file for the Apache HTTP Server. It allows you to override server settings for a specific directory without needing access to the main server config (httpd.conf).
.htaccess file must be placed in the directory it should affectmod_rewrite must be enabled on your Apache server for redirect rulesAllowOverride All must be set in your Apache config for .htaccess to workChoose one canonical form for your domain — either always use www or never use it. This prevents duplicate content issues with search engines. Most modern sites prefer the non-WWW form.