我使用tomcat 7服务器,并将我的angular 5项目复制到根目录中。深度链接目前不起作用。我试过使用TuckyURL重写。
我在根目录中创建了一个WEB-INF文件夹。我在其中创建了一个名为lib的文件夹,并将文件“urlrewritefilter-4.0.3.jar”保存在那里。
WEB-INF文件夹还包含urlrewrite.xml文件和web.xml。
我希望有人能帮我解决这个问题。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN"
"http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
<!--
Configuration file for UrlRewriteFilter
http://www.tuckey.org/urlrewrite/
-->
<urlrewrite>
<rule match-type="regex">
<note>
Redirect all http requests to angulars index. html except /tcc/* cause its needed for backend operations
</note>
<condition name="request-uri" operator="notequal">^/tcc/*</condition>
<from>^.*$</from>
<to type="permanent-redirect" last="true">http://localhost:8080</to>
</rule>
</urlrewrite>
web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
</web-app>