Robots.txt will not display

We have been working on improving our SEO. Google search console says that robots.txt does not exist. I checked the public folder and it is there. I am looking at the router.js. We have a “catch all” route that I believe is not displaying the robots.txt. Here is a portion of the router.js:

import EmberRouter from '@ember/routing/router';
import config from './config/environment';

const Router = EmberRouter.extend({
  location: config.locationType,
  rootURL: config.rootURL
});

Router.map(function() {
  this.route('search');
  this.route('login');
  this.route('signup');
 .
 .
  this.route('faq');
  this.route('fees');
  this.route('ratings');
  this.route('terms', {path: 'tos'});
  this.route('privacy');
  this.route('backcountry', {path: '/*path'});   <=====
});

export default Router;

If I go to /robots.txt, I end up on the backcountry page.

How do I get the robots.txt file to display? Thank in advance. Bill

1 Like

This isn’t something you can control from inside your Ember app. This is controlled by whatever webserver is hosting your production site.

You need to get it to respond with the robots.txt file instead of with the index.html file when somebody visits the /robots.txt URL.

On most web hosting, that would be the default behavior as long as you’re actually deploying the robots.txt file, so I would check that first.

1 Like

Thank you for the reply. With what you have said, I figured out the problem. We have NGINX as the front end. I have changed the config to nginx so that it sends the robots.txt file.

Thanks again Bill

@Bill_Soranno I think this error cannot solve with ember app. This is controlled by whatever webserver is hosting your production site. If you will have after doing these same process then you can ask any thing about process. :slightly_smiling_face:

@triddlelover69 thank you for you response. I modified the config of Nginx so that it renders the robots.txt and the sitemap.xml.