How do I make a page redirect in a website?

Please tell me. I want to make a page that redirects to my pokemon trades.

Hey @lettucecrab,

You can do this using JavaScript by placing the following piece of code in your script.js:

window.onload = function() {
  window.location.href = "<THE SITE URL TO REDIRECT TO>";

Note that the redirect happens on onload of the page. If you want to redirect on mouse click, just use <a></a> tags as hyperlink.

Also, according to (, you could also use


but the difference between href and replace, is that replace() removes the URL of the current document from the document history, meaning that it is not possible to use the “back” button to navigate back to the original document.

Hope this helps!

Hey there!

There’s another and simple way if you’re using Express.

app.get('/mypage', (req, res) => {

Happy Glitching!

1 Like