The developers who are the privileged person to access the website sometimes they don’t want to show the extension of file such as .php, .html. You have numerous ways to either remove or to hide the extension of file. In this article, we are going to discuss about the deletion of .php, .html file extension along with the .htaccess file.

You can do the process of removing the file extension such as .php, .html in running with lengthy codes or manual procedure. Here you have to carry out only simple steps to remove the file extension. Most of the users are very fond to use the URL in user-friendly malfunction. Yes, it’s absolutely true with below example:

Eg: The current URL –

After deleting the extension of file, you will get the URL as

The reason behind it to delete the html or php file extension is to hide the actual process of website design from the hacker or may be its user requirement. If the hacker knows the file extension, then it would be very easy to hack the website. So, the user may delete or hide it from the visual appearance.

Let us see the steps to delete the file extension mentioned below:

Step 1: Firstly, login as the root admin to your cPanel.

Step 2: You can see the option File, from there choose the Files Manager


Step 3: At the right side of file manager section, you can see the settings. Tap the settings.


Step 4: You will get the window saying “Show Hidden Files”. Now tap the “Save” button.


Step 5: It is important to get the .htaccess file now. If you don’t have the file then the only option is you have to create it.

Step 6: Again from the “File Manager” select the edit button. Tap the edit.


Step 7: You have to add the below commands to the .htaccess file

Through the below code the file extension -e.g. will become

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php –f
RewriteRule ^(.*)$ $1.php [NC,L]
Step 8: After entering all the commands just click the button “Save changes” and close the window.


Step 9: In this step, the apache server will delete the .php file extension from the URL.

Note: The above step was used to remove the .php file extension. To know the deletion of .html file please do the below steps.

Through the below code the file extension -e.g. will become

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html –f
RewriteRule ^(.*)$ $1.html [NC,L]
Now, you will have an idea to delete the extension of files by doing the above method. It is very simple and no chaos while doing it. You should have one thing in mind while deleting the extension by mistake you may delete the .htaccess file. It is very important to notice in PHP script such as MediaWiki, WordPress and Drupal cannot function without the .htaccess file. So you should do the deletion of file extension carefully. You can change your requirements in .htaccess file by using the account Filezilla via FTPclient.
First release
Last update
0.00 star(s) 0 ratings