Today we will talk about how to remove the .html extension from url.
This is your html website url.
https://www.expertsphp.com/how-to-remove-html-extensions-from-url.html
But you want to convert it to https://www.expertsphp.com/how-to-remove-html-extensions-from-url url.
We use the .htaccess file to remove the .html extension.
So let’s go and I’ll explain you with the code. To remove the .html file, write script code is written in the .htaccess file, which is the code I will provide you. This is a tested code. To apply this code first, you must create an .htaccess file and add this code written below to that htaccess file and add this file to your project folder. add it.
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.html [NC,L]