Urlrewrite(url地址重写)和UrlRewriteFilter
Urlrewrite:
UrlRewrite的含义:
优点
使用范围
地址重写一般是用于将动态地址伪静态。如果本身就是静态就没必要了。地址重写后网站制作者可以通过输入地址名直接访问。
UrlRewrite的使用:
UrlRewriteFilter使用步骤:
<dependency><groupId>org.tuckey</groupId><artifactId>urlrewritefilter</artifactId><version>4.0.3</version> </dependency>
<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>
<name>(这里是规则名称)</name><note>(规则的注释,说明规则是干什么的)</note><from>(请求的地址)</from><to type="redirect">(重写后的地址)</to>
<name></name><note></note><from></from><to></to>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN" "http://tuckey.org/res/dtds/urlrewrite3.2.dtd">
<urlrewrite decode-using="utf-8">
<rule>
<!--在你在地址栏中输入http://localhost:8080/(应用名)/commonTemplateFile/degmb/degmb/index.html--><!--或者在你在地址栏中输入http://localhost:8080/(应用名)/commonTemplateFile/ggg/index.html--><!--或者在页面href中--><from>^/commonTemplateFile/(.*)\.html$</from><!--会将地址http://localhost:8080/(应用名)/commonTemplateFile/ggg/index.html重写http://localhost:8080/(应用名)/XXX.do?method=JJJ&path=/ggg 在方法中就可以获得参数值了--><to>/XXX.do?method=JJJ&path=$1</to>
</rule>
<rule>
<note><!--这个规则定义的是:对/test/status/这个的请求,将会被重定向到对这个请求/rewrite-status重写的地址-->The rule means that requests to /test/status/ will be redirected to /rewrite-status the url will be rewritten.</note><from> /test/status/ </from><to type="redirect"> %{context-path}/rewrite-status </to>
</rule>
<outbound-rule>
<note><!--outbound-rule定义的是:当response.encodeURL被调用(如果你使用的是JSTL标签c:url),那么url地址/rewrite-status将会被重写为/test/status/。上面的rule和这个outbound-rule意味着最后用户不会看见/rewrite-status这个地址,只会看见/test/status/在地址栏或者页面的超链接中-->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>
Urlrewrite(url地址重写)和UrlRewriteFilter相关推荐
- php重写地址,php url地址重写
地址重写: urlRewrite: 就是: 1. 将php的地址index.php不写只写Action模块和function方法, 或者 2. php地址转变成html地址, 就是一种假的html, ...
- cookie与session详解、url地址重写
cookie与session详解.url地址重写:https://www.cnblogs.com/l199616j/p/11195667.html
- apache2.2.21下为codeigniter配置url地址重写
2019独角兽企业重金招聘Python工程师标准>>> apache2.2.21下为codeigniter配置url地址重写 1.首先打开apache的配置文件,httpd.conf ...
- Apache的URL地址重写 RewriteCond与RewriteRule
Apache的URL地址重写 http://hi.baidu.com/sonan/blog/item/c408963d89468208bba16716.html 第一种方法:Apache环境中如果要将 ...
- Apache的URL地址重写(RewriteCond与RewriteRule)
Apache的URL地址重写 http://hi.baidu.com/sonan/blog/item/c408963d89468208bba16716.html 第一种方法:Apache环境中如果要将 ...
- JAVA WEB项目隐藏url真实路径,url地址重写UrlRewriteFilter
有这么一种情况,不想让别人知道你项目访问的真实url,或者为了让url方便记忆,想用自己想用的url,该怎么办呢? 1.隐藏url的真实路径 2.url的重写 UrlRewriteFilter可以完美 ...
- UrlRewriter url 地址重写
方法一:参考地址http://tuckey.org/urlrewrite/ 方法二:使用spring mvc restful 方法三:页面静态化.伪静态化,这里可以使用Apache.nginx 等工具 ...
- php url地址 怎么写,php url地址重写
地址重写: urlRewrite: 就是: 1. 将php的地址index.php不写只写Action模块和function方法, 或者 2. php地址转变成html地址, 就是一种假的html, ...
- [2007最后一博]Url地址重写,利用HttpHander手工编译页面并按需生成静态HTML文件...
很多朋友可能都讨论过ASP.NET中生成HTML的方法了,有按照模板用IO方法写文件 有在404错误页面内生成HTML的,有在Render内保存页面输出到HTML文件的. 今天我发一个配合Url重写利 ...
最新文章
- R语言可视化包ggplot2绘制线性回归模型曲线实战( Linear Regression Line)
- 街电与搜电网络营销外包合并,怪兽充电终上市共享充电市场将迎来新变化
- 《研磨设计模式》chap21 解释器模式Interpreter(1)模式介绍
- mybatis初始化过程
- 判断php图片是否存在,php判断远程图片是否存在
- java中notify是什么意思_java中wait,notify,notifyAll是什么?
- ENSP模拟器下载分享
- instagram第三方登录
- 快递单号物流查询自动识别接口【快递鸟API通用教程】
- 零基础入门:基于开源WebRTC,从0到1实现实时音视频聊天功能
- 【CS学习笔记】14、powerup提权的方法
- (解决)PHP GD 插入PNG图片后透明背景变灰色
- C语言常见头文件汇总
- Laravel框架中上传图片
- 企业级NewSQL数据库 超越MongoDB、Hbase、Cassandra
- spring boot新建报错,多处显示导包失败,显示犹如The import org.junit cannot be resolved报错
- 无聊猿将与 Coinbase 共同制作电影三部曲进军好莱坞
- .NET 对于构建系统应用的探索历程
- Weight Normalization(WN) 权重归一化
- 巧用美女照做微信吸粉,你会做吗?
热门文章
- 【杂谈】Remember-Me的实现
- Java数据结构——排序二叉树
- 记录一些使用化学软件的心得(含bug和问题解决)
- 《孩子,为你自己读书》(Yanlz+Unity+SteamVR+云技术+5G+AI+VR云游戏+多多图书馆+志存当高远+读万卷书如行万里路+术业有专攻+读书是对思想的一种升华+立钻哥哥++==)
- 关于K8s中Pod调度[选择器,指定节点,主机亲和性]方式和节点[coedon,drain,taint]标记的Demo
- 数字孪生智慧医院:构建三维人体监测可视化管理平台(三)
- ubuntu14.04+caffe2
- 运筹学基础——库存管理
- JS数组合并的7种常见方法
- python opencv单目测距 小孔成像原理