Question

How to redirect 301 on the Digital Ocean Apps platform

How are 301 redirects made for websites on the DO App platform?

I would like to redirect certain pages such as:

domain.com/my-old-page/ redirects to domain.com/my-new-page/

I should mention that the content is being generated with Hugo static site generator.

Thank you for your time.


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

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.

Feedback on this problem: I was about to move some static sites to DigitalOcean to see if App Platform might work for us, but not having a simple way to do redirects adds a lot of friction. Redirects for static sites are very simple (and free) on other platforms. I thought migrating was going to be a quick, simple task, but it’s turning into a larger project, so I’m staying with the other service for now, even though it’s slightly more expensive.

This comment has been deleted

We don’t currently offer the ability to configure arbitrary redirects, though it is functionality we are considering.

You could run nginx as a service within your application using a Dockerfile. We have an example nginx Dockerfile and configuration available in our sample repos at https://github.com/digitalocean/sample-nginx. To avoid unnecessary load, I recommend keeping your existing routes for the huge application, and add new routes to nginx just for the parts you want to proxy.

There is another similar discussion related to routes & redirects that you may want to read over as well:

https://www.digitalocean.com/community/questions/how-should-i-implement-proxying-and-redirects-on-the-app-platform

Let me know if you have any further questions!