The steps to remove file extensions are:
- Login to your cPanel account.
- Go to File Manager – in the FILES Section
- Add the below lines to the .htaccess file. Click the Save Changes button and then the Close button.
#remove php file extension-e.g. https://example.com/file.php will become https://example.com/file RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php [NC,L] - Now the Apache web server will remove .php extension from URLs.
To remove .html extension use:
#remove html file extension-e.g. https://example.com/file.html will become https://example.com/file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html [NC,L]