To make your code work, you should consider the following:
the file extension
The files you want to run are language logic such as PHP ; then they must have .php
extension; what I mean is:
instead of having this: archivo.html
You must have this: archivo.php
The next thing is that you must run these files from an apache or ngnix server; if you are starting and working in Windows; the first is in packages like XAMPP that already include you: PHP, MySQL, Apache
Under the previous scenario, you should save your project in the following route
xampp/htdocs
And inside HTDOCS you are going to paste your folder with your project; Once the above is done, you will search to open the xampp panel from Start in Windows and by typing xampp panel
You will give Apache run and later in your browser do the following
localhost/nombreCarpetaProyecto
Where ProjectFolderName is the name of the folder where you stored your project
Note
You should consider that Apache by default will search for a file with the name index.php
to load its contents in the browser, otherwise it will show you the list of files that you have stored, consider naming one as I tell you
At least for what you mention, you do not need to configure anything in .htaccess