festus
My guess is that the contents of the template fragment are not what you want/need.
This google search has a different .htaccess file content than that shown in the wiki article your refer to.
Maybe try changing the template fragment content.
https://www.yireo.com/tutorials/joomla/joomla-administration/1338-get-rid-of-indexphp-in-your-joomla-urlsNote the conditions/directives & so on referred to in the .htaccess file are what you would be putting into the template fragment.
If it works in the .htaccess file, then it should work the same in the template fragment, as long as you implemented it correctly eg correct order, correct location etc.
The example you used from the wiki article was exactly that, an example, & may not suit your specific needs.
There are many search results on google for your issue.
Now:
What are the contents of the .htaccess file ?
Is this the default .htaccess file that Joomla provides ?
I assume you are following the generic instructions that Joomla advises, in order to hide or obscure or remove the index.php name from the URL.
Is that correct & is that what you want to achieve ?
ie is that what you mean by asking "How to hide index.php" ?