web.xml 配置:
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>confReloadCheckInterval</param-name>
<param-value>30</param-value>
</init-param>
<init-param>
<param-name>logLevel</param-name>
<param-value>WARN</param-value>
</init-param>
<init-param>
<param-name>statusEnabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>statusPath</param-name>
<param-value>/status</param-value>
</init-param>
<init-param>
<param-name>confPath</param-name>
<param-value>/WEB-INF/classes/urlrewrite.xml
</param-value>
</init-param>
</filter>
urlrewrite.xml配置:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE urlrewrite SYSTEM "../resources/urlrewrite3.2.dtd" >
<urlrewrite>
<rule>
<note>
无参数匹配
</note>
<from>^/([_a-zA-Z]+[_0-9a-zA-Z-/]*[_0-9a-zA-Z]+)$</from>
<to type="forward">/$1.do</to>
</rule>
<rule>
<note>
将所有.jsp文件映射为.html
</note>
<from>^/([_a-zA-Z]+[_0-9a-zA-Z-/]*[_0-9a-zA-Z]+).html$</from>
<to type="forward">/$1.jsp</to>
</rule>
<!--
<outbound-rule>
<note>
The outbound-rule specifies that when response.encodeURL is called (if you are using JSTL c:url)
the url /rewrite-status will be rewritten to /test/status/.
The above rule and this outbound-rule means that end users should never see the
url /rewrite-status only /test/status/ both in thier location bar and in hyperlinks
in your pages.
</note>
<from>/rewrite-status</from>
<to>/test/status/</to>
</outbound-rule>
EXAMPLES
Redirect one url
<rule>
<from>/some/old/page.html</from>
<to type="redirect">/very/new/page.html</to>
</rule>
Redirect a directory
<rule>
<from>/some/olddir/(.*)</from>
<to type="redirect">/very/newdir/$1</to>
</rule>
Clean a url
<rule>
<from>/products/([0-9]+)</from>
<to>/products/index.jsp?product_id=$1</to>
</rule>
eg, /products/1234 will be passed on to /products/index.jsp?product_id=1234 without the user noticing.
Browser detection
<rule>
<condition name="user-agent">Mozilla/[1-4]</condition>
<from>/some/page.html</from>
<to>/some/page-for-old-browsers.html</to>
</rule>
eg, will pass the request for /some/page.html on to /some/page-for-old-browsers.html only for older
browsers whose user agent srtings match Mozilla/1, Mozilla/2, Mozilla/3 or Mozilla/4.
Centralised browser detection
<rule>
<condition name="user-agent">Mozilla/[1-4]</condition>
<set type="request" name="browser">moz</set>
</rule>
eg, all requests will be checked against the condition and if matched
request.setAttribute("browser", "moz") will be called.
-->
</urlrewrite>
分享到:
相关推荐
NULL 博文链接:https://jilongliang.iteye.com/blog/2035179
URL 重写是截取传入 Web 请求并自动将请求重定向到其他 URL 的... l 易于被搜索引擎收录 Url ReWrite(URL重写的例子) web.config的配置和参数的传递,利用正则表达式批评URL地址,继承page类防重写
urlrewrite java 路径重写
转换源 + 目标 URL 的 CSV 并生成 IIS UrlRewrite 映射以放置在 web.config 中。 先决条件 信息系统 IIS UrlRewrite 模块 2.0 使用重定向映射的已配置重写规则 生成重写映射 控制台应用程序接受两个参数:CSV 文件...
很多时候我们不希望用户看到我们网站的真实地址,这时可以用rewrite包做url地址重写,让用户看到一些目录或者html地址,从而保护一些重要信息.具体使用方法请参考http://www.geelou.com/article/102.html
下了十几个版本,经测试这版确实可用的,好多IDC用的就是这实现的Url重写,一个httpd.ini文件,直接搞定,支持二级域名重写和301跳转很好用
内带url重写源码,解决表单action属性没有输出重写路径的问题
ISAPI_Rewrite 是一款适用于IIS的功能强大的基于正则表达式的URL处理模块。它兼容Apache的mod_rewrite的语法,从而使仅仅复制.htaccess文件就把配置从appach移植到IIS中或者从IIS移值到appach中变成可能。请参阅3.2...
三、一键安装URLRewrite组件。 勿需任何设置即可使您的服务器支持shopex,discuz,phpwind,ecshop,dvbbs,uchome等等 常用应用程序的伪静态重写规则。 四、自动设置服务器权限。 即使是新手,通过集成包中的目录安全...
这是Sass 3.3+的实验性插件,允许重写url()值中的路径。 Sass中的相关问题: : 不要使用这个。 覆盖的url已被弃用,并将从Sass的未来版本中删除。 什么? 例子: @import " rewrite-url " ; // set $rewrite-url...
三、一键安装URLRewrite组件。 勿需任何设置即可使您的服务器支持shopex,discuz,phpwind,ecshop,dvbbs,uchome等等 常用应用程序的伪静态重写规则。 四、自动设置服务器权限。 即使是新手,通过集成包中的目录安全...
URL重写有利于网站首选域的确定,对于同一资源页面多条路径的301重定向有助于URL权重的集中 Nginx URL重写(rewrite)介绍 和apache等web服务软件一样,rewrite的组要功能是实现RUL地址的重定向。Nginx的rewrite...
我想要的结果无非是去掉URL路径中的index.php 首先是配置.htaccess RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] ...
URL重写好处有很多,如有利于SEO、便于记忆、隐藏真实路径使安全性提高、便于更新等等。本文概要描述了各种URL重写的实现。 ASP.NET 2.0 中实现URL重写有很多方法,如:Global.asax中捕获用Application_...
1,服务器环境本身支持url rewrite重写功能,能正确识别出以路径符号 "/" 为间隔的url地址,这是必要的条件。 以apache为例说明如可开启伪静态:打开apache的配置文件找到对应的web目录配置项,修改为如下: ...
Apache 2.x 中URL重写,是通过mod_rewrite.so 来实现的,所以您要查看您的Apache 是否已经被编译进去这个模块了,并且在Apache的配置文件httpd.conf 中已经调用了这个模块
这个 mimosa-combine 转换包将重写图像的相对 url 路径,以解决 mimosa-combine 可以破坏相对路径的事实。 有关 mimosa-combine 转换的信息,请查看 mimosa 。 安装 从 Mimosa 项目的根目录,输入npm install mct-...
如果路径匹配,则任何后续的重写规则都将被忽略。 代理服务器[P](尚未实现) 代理您的请求'^/test/proxy/(.*)$ http://example.org/$1 [P]' 重定向[R],[R = 3 **](用数字替换*) 发出重定向请
2、支持Url分页方式下的Url重写(UrlRewrite)功能 Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, ...
2、支持Url分页方式下的Url重写(UrlRewrite)功能 Url重写技术可以使显示给用户的Url不同于实际的Url,Url重写技术被广泛应用于搜索引擎优化(SEO)、网站重组后重定向页面路径以及提供用户友好的Url等方面, Data...