Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Where should a robots.txt file exist inside a Payload application?

default discord avatar
mrl7last year
2

We need to store a robots.txt on our CMS site but we are not sure exactly where this file should live. Can anyone assist?

  • default discord avatar
    filippomasonilast year

    Following this, I also need to place a robots with disallow: / because I don't want search engines to crawl the backend of the site

  • discord user avatar
    denolfe
    last year

    This can be done via Express. You can add this to your

    server.ts

    :



    app.get('/robots.txt', (_, res) => {
      res.type('text/plain')
      res.send('User-agent: *\nDisallow: /')
    })


    Modify as needed

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team..