Web Hosting Forum - Net Hosting Talk

We are a community of individuals and businesses passionate about web hosting. Let's build, learn, and grow together.

I want to remove .html extension from the website pages

KennethJer

Novice
Member
Hello,

If I open a page on my html website, for example, www.example.com/demo my website shows www.example.com/demo.html. Is there any way to hide the .html extension so the extension doesn't show when someone visit to the page.
 
  • Advertisement
  • You need to use .htaccess rewrite rule.
    it's so simple
    if you don't have .htaccess file, just create one and if you have, open your editor on it
    then you should write the code below:

    Apache config:
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule   ^(.*)\.htm$    $1.html    [NC,L]
     

    Advertisement

    Back
    Top