Hi,
It is possible to me a code that is injected in .htaccess and this provide this problem.
The code can be from a plugin or it can be a malware injection.
Also, please check this article https://wpbrainery.com/wordpress/how-to-fix-a-corrupted-htaccess-file/
I hope this will help you!
Hello,
Normally the .htaccess file is generated by WordPress, but it can be injected with extra code using functions, plugins, malwares. So if you have those kind of problems it will be better to ask your host about the security that they provide for your website and how to prevent this kind of situations.
Also, maybe those articles can help you:
How to Scan WordPress for Malware in 4 Easy Steps
How to Scan Your WordPress Site for Potentially Malicious Code
Thank you!
Be sure to check if you have an AMP plugin running as this will add redirection code to things like content.page/amp and this will update the htaccess file — also any redirection plugins that might have an automatic setting running to automatically update URLS.
Make sure not using any ‘nulled’ plugins off the web and not from the WordPress.org repo.
Also good to download the file via ftp, and inspect it. Resave with linux line breaks unless windows pc, make sure saved as UTF-8 format. Set permissions to read only, then check error logs to see what is trying to write to it and failing with read only permissions. (Cannot be corrupted if set to read only, vs write permissions need to be on to alter it.)