Pick the rules you need and paste the result above the # BEGIN WordPress block. Back up your existing file first.
Read this first
Back up your current .htaccess before changing it. A single bad directive takes the whole site down with a 500 error, and you will need FTP or file manager access to undo it.
Paste these rules above the # BEGIN WordPress block. WordPress rewrites everything between its own markers, so anything you put inside them is eventually lost.
These are Apache and LiteSpeed directives. On Nginx they do nothing, and the equivalent rules go in your server block instead.
