0

I have a Grails app and want to make a robots.txt and sitemap.xml file. I read that the best way to put them into the application is in the web-app folder. When I run the site locally and test http://mysite/app/robots.txt everything works, but when I deploy the application to the production server I get a 404 and I can confirm that the files are not in the root tomcat folder.

Does anyone know what is going on here? Thanks.

skaz
  • 21,962
  • 20
  • 69
  • 98
  • Can you try hitting `http://mysite/app/static/robots.txt`? – dmahapatro Jul 04 '13 at 14:17
  • @dmahapatro I just tried. The file isn't deployed there either. – skaz Jul 04 '13 at 14:19
  • Using Grails 2.2.1 I can see robots.txt in the root of my war file. –  Jul 04 '13 at 14:43
  • Same here. Using Grails 2.2.2 I was able to access the text file when I packaged a grails app and deployed to external Tomcat in localhost. I tried with an url like `http://localhost:8080/myApp-0.1/abc.txt`. – dmahapatro Jul 04 '13 at 14:45
  • It looks like it may be a Tomcat issue. I am deploying to the root context in Tomcat6 and it doesn't work, but when I deploy to another context it looks like the files DO show up. I'll investigate more. – skaz Jul 04 '13 at 14:56
  • check if you have grails.serverURL set on your config file, in case you have something for develop environment not for production :) – Saurabh Dixit Jul 04 '13 at 15:08

2 Answers2

0

you can use the UrlMappings.groovy to map an Url to a view like

"/robots.txt" (view: "/robots")

and in the "/views/" directory is your robots.gsp, then yoou shouldn´t have any environment specific-problems

john Smith
  • 17,409
  • 11
  • 76
  • 117
0

Sorry all - looks like this was just a local issue. When I deployed to Tomcat I usually restart the service quickly because I need to update another file - A hacked process. It turns out that I was restarting the service too quickly before the root folder had time to populate with the .txt files. The weird part is all of the sub-folders had already populated, so it must be that the actual files (as opposed to the folders) of the root directory are populated last for some reason. In any case, this is a non-issue.

skaz
  • 21,962
  • 20
  • 69
  • 98