【问题标题】:urlrewritefilter tuckey configuration for tomcat 7.0.64tomcat 7.0.64 的 urlrewritefilter tukey 配置
【发布时间】:2016-06-25 09:02:36
【问题描述】:

我正在尝试配置 urlrewritefilter 4.0.3,但我不确定是否理解说明并以正确的方式进行设置。 我正在使用安装在 /opt/apache-tomcat-7.0.64/ 下的 apache-tomcat-7.0.64 并具有以下配置:

使用 CATALINA_BASE:/opt/apache-tomcat-7.0.64 使用 CATALINA_HOME:/opt/apache-tomcat-7.0.64 使用 CATALINA_TMPDIR:/opt/apache-tomcat-7.0.64/temp 使用 JRE_HOME:/opt/jdk1.7.0_80/jre 使用类路径:/opt/apache-tomcat-7.0.64/bin/bootstrap.jar:/opt/apache-tomcat-7.0.64/bin/tomcat-juli.jar

我的配置如下:

urlrewritefilter-4.0.3.jar  under folder /opt/apache-tomcat-7.0.64/lib
web.xml and urlrewrite.xml files under /opt/apache-tomcat-7.0.64/webapps/ROOT/WEB-INF
configuration for these files are:
    web.xml content ini  
        <?xml version="1.0" encoding="ISO-8859-1"?>
    <!--
     Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements.  See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License.  You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    -->

    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                          http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
      version="3.0"
      metadata-complete="true">

        <filter>
            <filter-name>UrlRewriteFilter</filter-name>
            <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>

            <!-- set the amount of seconds the conf file will be checked for reload
            can be a valid integer (0 denotes check every time,
            empty/not set denotes no reload check) -->
            <init-param>
            <param-name>confReloadCheckInterval</param-name>
            <param-value>0</param-value>
            </init-param>
        </filter>

        <filter-mapping>
            <filter-name>UrlRewriteFilter</filter-name>
            <url-pattern>/*</url-pattern>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>FORWARD</dispatcher>
        </filter-mapping> 

    </web-app>
    web.xml content end     
    ******************************
    urlrewrite.xml content ini 
    <?xml version="1.0" encoding="utf-8"?>

    <!DOCTYPE urlrewrite
    PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
    "http://www.tuckey.org/res/dtds/urlrewrite3.0.dtd">

    <!--
    UrlRewriteFilter from http://tuckey.org/urlrewrite/ proyect
    -->
    <urlrewrite>
        <rule>
            <name>redirect</name>
            <condition name="host" operator="notequal">^www.tucarne.com</condition>
            <from>^/(.*)</from>
            <to type="permanent-redirect" last="true">http://www.tucarne.com/$1</to>
        </rule>
    </urlrewrite>

    urlrewrite.xml content end

正如我从手册和常见问题解答中获取的那样,web 和 urlrewrite 文件设置在正确的路径中,并且包含正确的内容,但它不起作用。我不知道为什么错了。

你能帮我吗?

提前致谢。

【问题讨论】:

    标签: tuckey-urlrewrite-filter


    【解决方案1】:

    请注意,ROOT Web 应用程序不服务其他 Web 应用程序的请求。例如。如果您部署 Web 应用程序 WEBAPP1,则 URL [protocol]://[hostname]:[port]/WEBAPP1/somepage.html 将不会由 ROOT Web 应用程序提供服务。

    它将由 Web 应用程序 WEBAPP1 提供服务。

    如果您在 ROOT Web 应用程序中配置了土耳其过滤器,那么它将只处理对 ROOT Web 应用程序的请求(上下文路径是零长度字符串;即 [protocol]://[hostname]:[port]/[protocol]://[hostname]:[port]/?somearg=value)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-22
      • 2021-01-29
      • 2016-01-12
      • 1970-01-01
      • 2011-09-24
      • 2011-12-12
      • 1970-01-01
      相关资源
      最近更新 更多