what ever user type in URL redirect to main page

Splash Forums PrettyFaces Users what ever user type in URL redirect to main page

This topic contains 4 replies, has 2 voices, and was last updated by  Anonymous 4 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19468

    Anonymous

    in pretty faces is it possible, what ever user type in URL, then request will redirect to any page( which i want to set like: home or login ) for e.g: http://localhost:8080/myApp/home this is my URL but if user types random keys manually http://localhost:8080/myApp/hodgsdgdsdgsdgsd it redirect to this http://localhost:8080/myApp/home i want that..

    #23391

    You could do something like this with a custom rewrite processor. See the part of the documentation for details:

    http://ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/inbound_rewriting.html

    However I don’t think this will be easy. You will have to make sure that the redirect occurs only for URLs that would result in a 404. This means that you will have to make sure you don’t break your CSS files or graphics.

    #23392

    Anonymous

    ok tell me how to i set a page for 404 if user type wrong URL like in your forum PAGE EATEN BY SHARK any idea ?

    #23393

    Just use the <error-page> element in your web.xml:

    <error-page>
    <error-code>404</error-code>
    <location>/my-error-page.html</location>
    </error-page>

    You don’t even need Rewrite/PrettyFaces for this to work. :)

    #23394

    Anonymous

    thanks will use it soon :)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.