This section expands our ads.txt setup article to cover steps on setting up a 301 redirect for Node.js / Express web servers.

  • Open the node.js file where your routing is commonly done.

  • Add configuration similar to the follow in the file, replace #### with the ID of your property, found in your site list in the NitroPay panel.

app.get("/ads.txt", function(req, res) {
  res.redirect(301, "");
  • Save the file and deploy your website.

  • Test that the redirect works by going to and noting that the URL and contents changed to the hosted ads.txt.

Did this answer your question?