Question

Do Digital Ocean App Specifications support wildcards for URL rewrites and redirects?

Hi Digital Ocean Community,

I host a static personal website on Digital Ocean App Platform. I want every request that excludes the .html extension to redirect to the .html page. Currently I have to write each of these rules individually per page, as shown below.

For example: tobkin.us/contact ->302-> tobkin.us/contact.html

Is there any way I can use a wildcard instead to condense this App Specification? Or even better, rewrite all *.html pages to have no extension so there is no redirect?

ingress:
  rules:
  - component:
      name: tobkin-static-html
    match:
      path:
        prefix: /
  - match:
      path:
        prefix: /index
    redirect:
      redirect_code: 301
      uri: /index.html
  - match:
      path:
        prefix: /resume
    redirect:
      redirect_code: 301
      uri: /resume.html
  - match:
      path:
        prefix: /contact
    redirect:
      redirect_code: 301
      uri: /contact.html
  - match:
      path:
        prefix: /office-hours
    redirect:
      redirect_code: 301
      uri: /office-hours.html

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel