---
title: "Removing File Extensions using .htaccess"
description: "Lately, there seems to be a trend where designers want to cloak their file extensions from their visitors. For example, they want the URL domain.com/index.html to display as domain.com/index for..."
url: https://www.inmotionhosting.com/support/website/remove-file-extensions/
date: 2012-08-01
modified: 2023-11-30
author: "Scott Mitchell"
categories: ["Website"]
type: post
lang: en
---

# Removing File Extensions using .htaccess

Lately, there seems to be a trend where designers want to cloak their **file extensions** from their visitors. For example, they want the URL *domain.com/index.html* to display as *domain.com/index* for whatever reason. Some like the way it looks, others believe it helps with SEO, and others believe it is better for security. I am unsure the last two hold any bit of truth, however. This is a feature you can implement via your [htaccess file](https://www.inmotionhosting.com/support/website/htaccess-file/). This article will guide you through doing so via your cPanel.

## How to Remove File Extensions from URLs via htaccess

1. [Log into your cPanel](/support/edu/cpanel/how-to-log-into-cpanel/).
2. Find the **Files** category and click on the **File Manager** icon.![Click on File Manager in cPanel](https://www.inmotionhosting.com/support/wp-content/uploads/2012/08/edu_htaccess_file-manager-pl.png)
3. In the top right hand corner, click on **Settings**. For the primary domain, click on the **Web Root** radio button. For addon domains, click on the dropdown and find your desired addon domain name. Be sure the checkbox next to **Show Hidden Files** is checked. Click the **Save** button to return to the main *File Manager* screen.![Show hidden files in settings](https://www.inmotionhosting.com/support/wp-content/uploads/2012/08/edu_htaccess_hide-extensions-show-hidden-files.png)
4. You should now be in the root folder of the domain you chose. Look for the *.htaccess* file and right click on it. This brings up a menu. Find and click on the **Edit** option. If you get a popup box, simply find and click the **Edit** button in the lower right corner to continue to the editor.![Click on edit](https://www.inmotionhosting.com/support/wp-content/uploads/2012/08/edu_htaccess_hide-extensions-click-edit.png)
5. You are now in the text editor. As most sites are coded with either html or php, we have include the code for both below. Apache ``` RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php ```   Apache ``` RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ $1.html ```
6. Be sure to hit the **Save Changes** button in the upper right corner to save your new htaccess configuration. Your site should now display the address without the file extension.
