Outcome of Redirect does not contain context path

Splash Forums Rewrite Users Outcome of Redirect does not contain context path

This topic contains 1 reply, has 2 voices, and was last updated by  Lincoln Baxter III 2 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #24911

    youngreymond
    Participant

    I have all my pages under /web/ folder, there is a rule that redirects me to my home path (ex: http://ip:port/contextpath/web/home) when the url does not contain the /web/ at the start, any posible url that does not match /web/ (ex: /whatever/mypage) is not valid for me and I want to redirect to my home (/web/home).

    thanks for any help.

    #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"))
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Comments are closed.