[英]Change part of the url using url redirect
I have an issue where the image paths in css files need to be changed dynamically. 我有一个问题,其中css文件中的图像路径需要动态更改。 Currently the image links are like
url(../../image/image.png)
in some css files. 当前,某些CSS文件中的图片链接类似于
url(../../image/image.png)
。 In others the links are like url(../image/image.png)
. 在其他情况下,链接类似于
url(../image/image.png)
。
I am packing all the css files into one file using pack:tag
and as a result, the ../../image/image.png
links get broken when accessed from the packed css file as from the packed css file, the correct path becomes ../image/image.png
. 我使用
pack:tag
所有css文件打包到一个文件中,结果,从打包的css文件访问打包的css文件时, ../../image/image.png
链接断开,正确的路径变为../image/image.png
。
I was told that the way to fix the issue is to use url redirect and tuckey but I am unsure about the process. 有人告诉我解决此问题的方法是使用url重定向和tuckey,但是我不确定该过程。 I added the filter in web.xml, but what rule should I add in the urlredirect.xml ?
我在web.xml中添加了过滤器,但是应该在urlredirect.xml中添加什么规则? Currently it reads:
目前显示为:
<rule> <from>.*/behavior/(.*)</from> <to type="forward">/css/$1</to> </rule>
I'd get around that by using absolute references rather than relative. 我会通过使用绝对引用而不是相对引用来解决这个问题。 So use
url(/yourfolder/image/image.png)
. 因此,请使用
url(/yourfolder/image/image.png)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.