Redirecting a file to another link

I have a file in my glitch (express) and I uploaded a file to it. I can go to the file with the link of it but I wonder if it’s possible to redirect that page to another link.

Like if someone goes to that link, I want to redirect them to another website but in server.js, not as html or something.

You make a get http request with the path of your file. And then in the response you use res.redirect() with the path or url you want to redirect the user to.

app.get('/name_of_your_file', (req, res) => {
  res.redirect('/path/you/want/to/redirect')
});

https://expressjs.com/es/4x/api.html#res.redirect

2 Likes

can you check your discord if you’re available, please?