Have you tried putting the code in a .php file and just calling it? If I remember correctly, the InfinityFree servers are setup to directly process .php files instead of opening / downloading them.
I know it’s an overkill for 2 lines of code, but I guess it’s worth a try.
It is not even a problem, servers are configured to don’t run php-executor on non php files in order to prevent server overloading and reaching daily limits.
I personally don’t recommend it. Making server to run php in html files reaches limits faster. That’s why it’s recommended to use html for static websites since there’s no php executed in non php files by default.
@AdYouWebs It’s quite illogical what your asking, why don’t you just rename your file to .php? There’s no harm in doing it. .php is made to execute PHP scripts and .html files are made for HTML codes, it’s a fact.
I don’t know if that .htaccess code is safe or not, but like most things, it probably has a side effect or a downside.