How to hide PHP extension using htaccess file

Posted at March 6, 2018 2783 Views . 1 Saved .

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 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.

Coding is an art and I love art
sorry bhai!
Rizwan Khan
Please be polite if you want something and update your comment
its okay!
It's not working in mvc.php on Godaddy windows server