Reply To: Redirect when does not contain path

Splash Forums Rewrite Users Outcome of Redirect does not contain context path Reply To: Redirect when does not contain path

#24915

Could you please post the source of your rule?

More than likely, I’m guessing you did not prepend the context-root. This must be done by hand (since you may at times want to redirect outside of the current context, but still on the same appserver.)

Otherwise, if your app is served under the context: “app1”, and you have another app under the context root “app2”, you would not be able to redirect from app1 to app2, or visa versa. You would also not be able to redirect to a URL that lives outside of the application context-root, unless you specified a fully qualified URL.

For example:


.addRule()
.when(Direction.isInbound().and(Path.matches("/something")))
.perform(Redirect.temporary(context.getContextPath() + "/something-else"))

// Redirect to a URL in another application, or at the root of the appserver.
.addRule()
.when(Direction.isInbound().and(Path.matches("/something")))
.perform(Redirect.temporary("/app2/something-else"))