I'm trying to remove the .html
from my landing page, an example would be instead of domain.com/contact.html
it would be domain.com/contact
while at the same time keeping the .html
for all the folders within the website, so domain.com/components/file.html
would stay as a .html
..
So in other words redirect for the landing page, but not for all the other files on my server..
This is the code I'm currently using to remove the .html
but it also removes it for all the other directories as well.
#example.com/page will display the contents of example.com/page.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
#301 from example.com/page.html to example.com/page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
Would anyone have any advice on this matter?