Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put robots.txt in tomcat 7?

I'm using Tomcat 7 to host my application. I've used a ROOT.xml file under tomcat-home\conf\Catalina\localhost

<Context 
  docBase="C:\Program Files\Apache Software Foundation\Tomcat 7.0\mywebapp\MyApplication" 
  path="" 
  reloadable="true" 
/>

This is to load my webapp in the root context.

But now I'm confused as to where to put the robots.txt and sitemap.xml files. When I put in under C:\Program Files\Apache Software Foundation\Tomcat 7.0\mywebapp\MyApplication, it doesn't show up.

I've also tried placing it inside C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT , just in case. But nothing works. I'm still getting 404 not found. Can anyone please guide.

p.s. My web application runs fine. It's just that my robots.txt file is unreachable.

EDIT

My web.xml file:

    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy
        </filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
like image 686
LittleLebowski Avatar asked Dec 15 '12 10:12

LittleLebowski


People also ask

Where should robots.txt be located?

Format and location rules: The robots.txt file must be located at the root of the website host to which it applies. For instance, to control crawling on all URLs below https://www.example.com/ , the robots.txt file must be located at https://www.example.com/robots.txt .

Is the robots.txt in the root directory of your domain?

A robots. txt file is a text document that's located in the root directory of a site that contains information intended for search engine crawlers about which URLs—that house pages, files, folders, etc.


1 Answers

Just put the robots.txt in Tomcat_DIR/webapps/ROOT/

like image 104
penguin Avatar answered Nov 15 '22 02:11

penguin