it looks like my .htaccess file has disappeared. Please could you restore it. I had added the lines to force HTTPS but when I saved the file it vanished. Now I’m getting 404 errors.
OK, so I can edit the .htaccess file using the supplied tools but this will result in it’s deletion without warning, breaking the site, and you cannot fix it because there’s no backup. That’s hardly helpful. For anyone who encounters this issue in future, the following is a .htaccess file which works. It’s not the same as the one that got away.
BEGIN WordPress
The directives (lines) between “BEGIN WordPress” and “END WordPress” are
dynamically generated, and should only be modified via WordPress filters.
Any changes to the directives between these markers will be overwritten.
I understand that this isn’t a fun surprise, but there isn’t really a way around it.
We can only check the size of the uploaded file after the upload is complete, which means it’s too late to refuse the upload. And by then, the old file is overwritten too.
A file which works for WordPress, yes, and should only ever be used for a WordPress site. And even then, this contains some unnecessary directives. If you just need a working WordPress .htaccess file, you could just use the official WordPress .htaccess code instead: