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
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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey,
I believe that the DigitalOcean App Platform doesn’t currently support wildcard URL rewrites or redirects directly within the App Spec configuration. Each route has to be specified individually, as you’ve been doing.
The best thing to do to get your voice heard regarding this would be to head over to the DigitalOcean Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.
Hope that helps!
- Bobby.