React-router: How can I serve robots.txt on a SPA using the react router?

Created on 3 Feb 2016  路  1Comment  路  Source: ReactTraining/react-router

I have a single page application deployed on www.domain.com and I need to serve www.domain.com/robots.txt.

I'm still using the React Router 0.13.x.

So the problem is I need to serve up a static file and the router is catching all URLS and I get an warning: _Warning: No route matches path "/robots.txt". Make sure you have somewhere in your routes_

I can't create a handler for it because I have nothing to render, I just need to serve a static file.

How can I serve the robots.txt file in combination with the router?

>All comments

React Router 0.13.x isn't supported anymore.

But you need to make sure your server is configured to catch any URL _after_ it's configured to serve from a directory. This isn't a router problem, it's a server config problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CezaryDanielNowak picture CezaryDanielNowak  路  52Comments

CezaryDanielNowak picture CezaryDanielNowak  路  70Comments

taion picture taion  路  70Comments

ryanflorence picture ryanflorence  路  95Comments

evdama picture evdama  路  62Comments