I managed to remove the .extension via the htaccess file, but I was wondering if this is possible through the apache2.conf or some other file without using the .htaccess file.
Exp.
example.com/example
instead of
example.com/example.html
You can use these 2 rules in Apache conf file:
RewriteCond %{THE_REQUEST} \s/+(.+?)\.html[\s?] [NC]
RewriteRule ^ /%1 [R=302,L,NE]
# To internally forward /dir/file to /dir/file.html
RewriteCond %{DOCUMENT_ROOT}/$1\.html -f [NC]
RewriteRule ^(.+?)/?$ $1.html [L]