Put .html on every page URL

How to do it ??

How to make URL with HTML extension?

@sunil951, My first response is one of curiosity… What might be the rationale? Do you need to preserve urls when migrating an existing website?

Regardless the reason, the configuration setting append_url_extension, which should be added to ‘user/config/system.yaml’, might do what you are asking for:

pages:
  append_url_extension: .html

For the docs see Basics/Configuration/Pages:

append_url_extension:         Append page’s extension in Page URLs (e.g. .html results in /path/page.html )

Hope this helps…

But how to force pages to use single url. Currently , both URL working like

https://w3services.com/about-anti-spam-policy
https://w3services.com/about-anti-spam-policy.html

It create SEO issue so need only one.

@sunil951, What SEO issue do you think it creates?

A few thoughts:

  • I think there is a consensus on the web that urls without extensions are preferred.
  • Google doesn’t care whether a url ends with an extension, or slash, or no slash. But changing the urls may do harm. See video from Google’s John Mueller
  • Google indexes links you provide in the sitemap.xml. Using the ‘append_url_extension’ setting, all links generated by the sitemap plugin end with ‘.html’
  • All internal links generated by Grav (e.g. menu items) and which are crawled by Google, end with ‘.html’ too.

My current website created in plain html and now migrated to GRAV. What will be best way so that my google SEO not face issue. Have more than 10K backlinks.

Please guide.

Thanks. Plz, guide as per the below details.

Use permanent redirects from your old URLs to sensible ones that don’t use an extension. Then just use Grav the way it’s designed out of the box. That really seems easiest to me.

Thank you for sharing and helping.