Welcome to Web Hosting Forum - Net Hosting Talk

Register now and be part of our community! When you register with the Net Hosting Talk you can join in with topics, start new topics, and generally be a part of the first level of our community. It's also quick and totally free, so what are you waiting for?

I want to remove .html extension from the website pages

KennethJer

Newbie
Messages
2
Reaction score
0
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.
 

devshost

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