简体   繁体   中英

How to redirect url using tuckey urlrewrite

I have a webpage named 'index.html', and I can use ' http://example.com/index.html ' to access it.

What I intend to do is to access the 'index.html' using ' http://example.com/index.htm '; If using ' http://example.com/index.html ', an 404 will return.

I'm using tuckey urlrewrite , and here is my config xml:

<rule>
    <from>^/(.*).htm$</from>
    <to>/$1.html</to>
</rule>

<outbound-rule>
    <from>^/(.*).html$</from>
    <to >/$1.htm</to>
</outbound-rule>

After deploying it, I can use ' http://example.com/index.htm ' to access my index.html, but when I'm using ' http://example.com/index.html ', it still can access my index.html.

What should I do to make the server returning 404 when *.html is being requested? Thanks a lot!

尝试添加<set type="status">404</set>进行规则/.*.html$的规则匹配吗?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM