How to remove .html from URL?

前端 未结 12 1558
轻奢々
轻奢々 2020-11-22 03:02

How to remove .html from the URL of a static page?

Also, I need to redirect any url with .html to the one without it. (i.e. www.exam

12条回答
  •  孤独总比滥情好
    2020-11-22 03:28

    For those who are using Firebase hosting none of the answers will work on this page. Because you can't use .htaccess in Firebase hosting. You will have to configure the firebase.json file. Just add the line "cleanUrls": true in your file and save it. That's it.

    After adding the line firebase.json will look like this :

    {
      "hosting": {
        "public": "public",
        "cleanUrls": true, 
        "ignore": [
          "firebase.json",
          "**/.*",
          "**/node_modules/**"
        ]
      }
    }
    

提交回复
热议问题