[英]How to redirect url using tuckey urlrewrite
我有一個名為“ index.html”的網頁,可以使用“ http://example.com/index.html ”進行訪問。
我打算做的是使用' http://example.com/index.htm '訪問'index.html'; 如果使用“ http://example.com/index.html ”,則會返回404。
我正在使用tuckey urlrewrite
,這是我的配置xml:
<rule>
<from>^/(.*).htm$</from>
<to>/$1.html</to>
</rule>
<outbound-rule>
<from>^/(.*).html$</from>
<to >/$1.htm</to>
</outbound-rule>
部署之后,我可以使用“ http://example.com/index.htm ”來訪問我的index.html, 但是當我使用“ http://example.com/index.html ”時,它仍然可以訪問我的index.html。
當請求* .html時,我應該怎么做才能使服務器返回404? 非常感謝!
嘗試添加<set type="status">404</set>
進行規則/.*.html$
的規則匹配嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.