.htaccess for SEO: the essential rules
What you configure via .htaccess
The key things for SEO: 301 redirects (merging www/non-www, HTTP→HTTPS, trailing slashes), caching static files (Expires/Cache-Control), gzip compression and blocking access to service files.
The generator assembles the needed blocks based on the selected options — you get ready code with comments.
Caution first
The .htaccess file is executed by the server on every request: an error in it takes the whole site down. Before changing it, save a copy, make edits step by step and check the site immediately.
After setting up redirects, check them with our redirect checker: the chain should collapse into a single 301 hop.