2

I have got links on my static website. These links are without .html extension.

https://zodoc.azurewebsites.net/posts/en/selective_blur - does not work

Error: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

https://zodoc.azurewebsites.net/posts/en/selective_blur.html - works fine

How to make it work without .html extension?

Alamakanambra
  • 5,845
  • 3
  • 36
  • 43
  • Are you using Static website hosting for Azure storage, or are you using a Web App? In the last case, you can have some rewrites in place that allow users to access the URL's without `.html`. See more info here: [Rewriting a URL in an Azure web app](https://stackoverflow.com/questions/36630536/rewriting-a-url-in-an-azure-web-app) – rickvdbosch Dec 03 '18 at 08:07
  • Any process now? – Joey Cai Dec 11 '18 at 05:21

1 Answers1

1

As rickvdbosch said, you could use URL rewrite to remove the .html extension in your URL.

Open the web.config and insert the following code inside the system.webServer node.

<rewrite>
      <rules>
          <rule name="RewriteURL" stopProcessing="true">
              <match url="^(.*)$" />
              <conditions>
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                  <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
              </conditions>
              <action type="Rewrite" url="{R:1}.html" />
          </rule> 
     </rules>
 </rewrite>
Joey Cai
  • 18,968
  • 1
  • 20
  • 30