Question

How to redirect user from page.com/tricks to page.com/tricks/

I’m a newcomer here, and my knowledge is somewhat limited.

Today, I undertook the migration of my Nuxt 3 website from Netlify to the DigitalOcean App Platform. While on Netlify, when a user opened ‘page.com/tricks,’ it would automatically redirect to ‘page.com/tricks/’ with a trailing slash. However, on the DigitalOcean App Platform, ‘page.com/tricks’ simply stays as ‘page.com/tricks,’ which is causing an issue.

I haven’t made any changes to the code, and I’ve deployed the same version here. I would greatly appreciate any assistance with this matter.


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.

Hey @rahulkumarsinghwalrus,

Indeed, you are correct this is not configurable out of the box with the App Platform and static sites. There is an option to do this for individual routes but it probably would not fit your needs for this use-case:

name: your-app-name
services:
- name: your-service-name
  routes:
    - path: /tricks
      redirect_to: /tricks/

It looks like someone has had the same idea before and has posted it on our Product Ideas board. The best thing to do would be to head over and add your vote to it, as well as adding any additional information in the comments for exactly what you’d like to see implemented!

https://ideas.digitalocean.com/app-platform/p/trailing-slash-on-directories

In the meantime what you could do is to use try and configure the trailingSlash to false which ensures that Nuxt’s internal routing would not expect the use trailing slashes:

https://v2.nuxt.com/docs/configuration-glossary/configuration-router/

Let me know how it goes!

- Bobby.

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