Help with htaccess rewrite

I’m trying to have the domain and html page name shortened, for example:

https://web-site.com/info-page.html
to be access from:
https://web-site.com/info-page

I tried this, in .htaccess file, without success:

RewriteRule ^info-page$ https://web-site.com/info-page.html [NC]

Any help to get this correct is appreciated

I think you are going to want something a bit more generic so that it matches all your pages right? Or is it just a few pages?

Try something like…

RewriteRule ^(.*)$ $1.html

What this is saying for any URL that matches, append the .html onto it when it goes to fetch the file on the server. Meaning you can then leave off the .html. Theoretically it should work. :slight_smile:

It would be better to check beforehand whether the requested URL already hits a file or folder, otherwise everything including images etc will be rewritten.

RewriteCond %{REQUEST_URI} !-d
RewriteCond %{REQUEST_URI} !-f
RewriteRule ^(.*)$ $1.html