Moved Permanently

From Resin 3.0

Jump to: navigation, search


When your website moves a URL or a whole section, you can use the <resin:MovedPermanently> rewrite-rule to redirect browsers to the new location.

resin-web.xml

In this example, we're redirecting a URL within the same web-app to a new location. /old gets moved to /new.

<web-app xmlns="http://caucho.com/ns/resin"
         xmlns:resin="urn:java:com.caucho.resin">

  <resin:MovedPermanently regexp="^/old" target="/new"/>

</web-app>

As part of Resin's rewrite capability, the <resin:MovedPermanently> rule will match if the URL matches the given regular expression. The "^/old" matches the beginning of the URL, so it doesn't match "/foo/old" by mistake.

As with all the rewrite rules, the first matching rule is used. If no rule matches, Resin's regular servlet dispatching applies.

Personal tools