A few simple techniques can help to hide PHP, possibly slowing down an attacker who is attempting to discover weaknesses in your system.
It does work in top-level directory AND subdirectories and it doesn't need hardcoding the RewriteBase.
I got it from https://www.php.net contributed by someone.
1- Open your project folder such as public_html
2- Create a .htaccess file within root(public_html) folder
3- Paste the code given below
4 - Save your .htaccess file
After doing these steps just create a sample file to test such as example.php and try to open it in your browser and you will see 404 Not Found Error then remove .php and write like this localhost/project/public_html/example It works for all directorories and sub-directories Thank you hope you like it Note : If you already have .htaccess file make sure your RewriteEngine is not on. If it is on just remove the first line Dont forget to press Red Heart.