Hide File Extension

Hide File Extension

Do you want to hide the file extension of your website’s script type?  At times you may not want to reveal the programming language of your website to your visitors.  This is an easy measure to help thwart off would be hackers or spammers.

Here is a simple technique you can use to make all of your .php files appears as though they are .html files instead.  You simply need to create or edit an existing .htaccess file.  Note: The .htaccess file must be placed within the root folder of your website.


# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html


Now each time  someone goes to yourdomain.com/index.html the browser will actually load index.php and simply change the extension to .html


Did you find value in this? If so please share this.

About the Author


Freelance web developer and designer residing in Pittsburgh, PA I enjoy creating custom applications and websites to solve real-world problems. When I am not coding away I enjoy trying new craft beers from around the world.

Leave a Reply

New Blog Post: MySQL Using the JOIN Operand Within a Query - http://goo.gl/KHUij