htaccess- Hide File Extension
I only used this code for the first time last week, but seems to work pretty well. The same code is plastered all over the internet on various websites, so I’m only jotting it down for my own personal reference.
Hiding File Extensions
What this piece of htaccess code basically does is allow you to access files without needing to reference the file extension. For example, you call the following page http://www.example.com/contact.php by simply using http://www.example.com/contact (.php not require)
I think it’s pretty cool. It even allows you to pass variables through the URL without needing the file extension. For example, you can do the following, http://www.example.com/contact?id=23
The code
Simply copy/paste the following into your htaccess file
1 2 3 4 | RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ /$1.php |
The example is specifically removing “php” file extensions- you can change that to whichever you want, I assume. I’ve only used it with php files so far
That’s it.



brightcherry.co.uk
This post rocks. I have also found a FREE utility to hide files under jpeg image. I used it. It is a poor man’s digital steganography application