baidu.com直接指向

       最近两天在给域名证书续费,但是需要外国证书认证机构给域名注册时留的邮箱发邮件确认,发了几次邮件,仍然没有收到邮件。于是,协商决定在网站下面放一个认证码,让国外访问来确定域名归属。

以下把我在配置过程中遇到的问题总结如下:

1、tomcat下新建目录下文件访问404

接到这个问题,想着很简单,在站点目录下面创建一个文件,然后全路径访问就好了,但是当真的这么做了以后,才发现事情并没有那么简单,检查过权限啊,重启啊,总是404.然后网上查资料,各种回答都有,有的说把web.xml放到新建目录下,照做后,问题

仍然没有解决。咨询了开发后,才知道开发在springMVC.xml下配置了启动tomcat后加载的资源和要拦截的地址(目录地址)。比如我要访问www.baidu.com/.well-known/1.txt,那么我就要在springMVC.xml下添加下面两行内容:

    <!-- 自动扫描controller包下的所有类,使其认为spring mvc的控制器 -->
    <context:component-scan base-package="com.hengxin.qianee.controller" />
    
    <mvc:annotation-driven />
    
    <mvc:resources mapping="/css/**" location="/css/" />
    <mvc:resources mapping="/images/**" location="/images/" />
    <mvc:resources mapping="/js/**" location="/js/" />
    <mvc:resources mapping="/skippr/**" location="/skippr/" />
 .......
    <mvc:resources mapping="/sitemap.txt" location="/" />
    <mvc:resources mapping="/sitemap.xsl" location="/" />
    <mvc:resources mapping="/silian.txt" location="/" />
    <mvc:resources mapping="/.well-known/**" location="/.well-known/" />  
    <mvc:interceptors>
          <!-- 使用bean定义一个Interceptor,直接定义在mvc:interceptors根下面的Interceptor将拦截所有的请求 -->  
          <mvc:interceptor>
              <mvc:mapping path="/**"/>
              
              <!-- 需排除拦截的地址 -->
            <mvc:exclude-mapping path="/.well-known/**"/>
            <mvc:exclude-mapping path="/css/**"/>
            <mvc:exclude-mapping path="/images/**"/>
            <mvc:exclude-mapping path="/js/**"/>
            <mvc:exclude-mapping path="/skippr/**"/>
            <mvc:exclude-mapping path="/account/getCity"/>
            <mvc:exclude-mapping path="/account/getAreas"/>

2、使用baidu.com直接访问网站。

猜你喜欢

转载自www.cnblogs.com/dadonggg/p/8932253.html