• Services
    • Web Hosting
    • Reseller Hosting
    • VPS Hosting
    • Dedicated Hosting
  • Domains
  • Features
  • Company
    • About Us
    • Server Locations
    • Affiliates
    • Company Blog
  • Support
  • Client Login
  • Services
    • Web Hosting
    • Reseller Hosting
    • VPS Hosting
    • Dedicated Hosting
  • Domains
  • Features
  • Company
    • About Us
    • Server Locations
    • Affiliates
    • Company Blog
  • Support
  • Client Login
Home/Article/Web Hosting/.htaccess/Remove page extensions using .htaccess

Remove page extensions using .htaccess

Written by VernalWeb
June 17, 2017

Creating a SEO Friendly URL has become much more easier now a days. Sometimes, developers don’t want to show their page extensions to the visitors which is also preferred for creating SEO Friendly URL. Such as, the URL ‘yourdomain.com/products.html‘ to display as ‘yourdomain.com/products‘ on browser’s address bar. Some like the way it looks, others believe that its helpful for SEO. That’s why they need to remove page extensions. and this is a feature that one can implement using .htaccess file. This article is a step by step guide on ‘How to remove page extensions using htaccess’.

    1. Login to your cPanel.
    2. Search for File Manager.
    3. Click on File Manager icon.
    4. In the top right hand corner, click on Settings. For the primary domain, click on the Web Root radio button. If you want to change this setting for a addon domain, 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 & the browser will return to File Manager screen.
    5. You should now be in the root folder of the domain you chose. Search for the .htaccess file, 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.
    6. You are now in the text editor. As most sites are coded with either htm or php, we have include the code for both below.

PHP Extension:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

HTML Extension:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

7. Make sure that you 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.


We hope this tutorial helps you find the perfect solution. If your like our tutorials, definitely you’ll love our support. All VernalWeb hosting plans include 24/7 support from our amazing inhouse support staff. Check out our web hosting plans and have your website migrated today!

Tags:htaccess

Was this helpful?

Yes  No
Related Articles
  • How to create or edit .htaccess file in cPanel
  • How to Redirect HTTP Requests to HTTPS with .htaccess
  • How to enable hotlink protection using .htaccess Code
  • How to create custom 404 page using .htaccess
  • How to Create SEO Friendly URL Using .htaccess
  • How to create 301 redirection using .htaccess

Didn't find your answer? Submit Ticket

Latest Articles

  • How to show Hidden Files (.htaccess) in cPanel File Manager
  • Setup a Domain Redirection in cPanel
  • Create a MySQL Database and a User from cPanel
  • Remove page extensions using .htaccess
  • Cron Job Usage & Policy
  • © 2014 - 2025 VernalWeb. All rights reserved.