Build .htaccess rules visually and download the file.
# Force HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Remove www
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]
# Prevent directory listing
Options -Indexes
# Custom error pages
ErrorDocument 404 /404.htmlGenerate Apache .htaccess rules visually - 301 redirects, HTTPS enforcement, www to non-www (or vice versa), custom 404 pages, password protection, caching headers, CORS, hotlink protection, and GZIP compression. No Apache syntax knowledge required. Copy the generated .htaccess rules directly into your server config.