I have website powered by WordPress and I also have .html files inside WordPress root folder since WordPress will not allow .html files , I have written .htaccess code to open .html files as well as wordPress pages but the problem is .htaccess file is modifying automatically and .html files will not work
What is causing this ?
my .htacces code
WordPress modifies the .htaccess file if necessary, but only the content of the
#BEGIN ... #END WordPress
block. Add your own entries outside of this block and WordPress will not touch them.Another option is to remove write access for the webserver to the file, so WordPress can’t modify it directly. WordPress will tell you to change the file if necessary.
The way the WordPress .htaccess file works, is it only routes URLs if the requested file does not exist.
For example,
http://www.example.org/file_exists.html
would return file_exists.html, howeverhttp://www.example.org/no_file_here.html
would be re-routed to WordPress, because the file does not exist.I can’t see a reason as to why you would need to modify your .htaccess to allow an html file to be viewable, unless you are manually rewriting the URLs for it – in which case, there are some plugins available for wordpress to include the rewriting in the .htaccess file.
As was previously mentioned, WordPress will only modify between the #BEGIN and #END lines, nothing else. However that’s not to say there’s nothing else modifying the file. For example, you may have a plugin such as WP Bulletproof Security, or WP Super Cache, which will completely overwrite the .htaccess. This is where a wordpress rewriting plugin can come in handy, as these plugins that modify the .htaccess file would check with a rewriting plugin first to include your changes.
As is recommended by WordPress’s security team, you can change the file permissions of the file to disallow writing, however this would break any legitimate plugins. See Hardening WordPress.
Check your index.php file and see if it look like that of original wordpress index.php
If is, then know your files are correpted and has got malware. You can replace files using wordpress repo here
https://github.com/WordPress/WordPress/
THEN install malware plugins to help you.