I want to remove .html extension from the website pages

Welcome to our community

Be apart of something great, join today!

KennethJer

Newbie
Messages
5
Reaction score
2
Points
3
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
  • devshost

    Newbie
    Messages
    3
    Reaction score
    0
    Points
    1
    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

    Top