Topic
  • 1 reply
  • Latest Post - ‏2013-06-25T13:36:56Z by bpaskin
racebannon38
racebannon38
1 Post

Pinned topic Neophyte - How do I redirect URL?

‏2013-06-21T17:35:25Z |

I am an absolute neophyte to web programming. I am working in IBM RAD 7.5.5 Eclipse w/ Java & Struts (also no experience using Struts) and using Websphere 7. An issue came up in which a user entered one character of our URL with the wrong case (upper-case vs lower-case). That generated a web page not found error. We'd like to redirect those "erroneous" URLs to the correct URL.

I've dug around and found various articles about URLs redirection. Some deal with changing Websphere configuration while others talk about changing an XML file in the Java web app (index.html, web.xml). I'm confused because too many assumptions are made by the responders about the experience level of the questioners and consequently, significant information is "masked" in the answer and I am not able to interpolate that information.

Can someone give me the simplest, more direct instruction on doing this kind of redirection. I don't believe this is something new for experienced developers. If you answer, please make no assumption of my knowledge of where files are located (or need to be located because they may not exist on my system), my knowledge of what files are in play, etc.

Thank You!

Mark

  • bpaskin
    bpaskin
    2 Posts

    Re: Neophyte - How do I redirect URL?

    ‏2013-06-25T13:36:56Z  

    Hi, you can setup the HTTP Server to redirect by modifying the httpd.conf file by placing the following:

    ErrorDocument 404 /path/to/error/document.html

    If you want the web application to redirect on error then you can add the following to the web.xml:

    <error-page>
       <error-code>404</error-code>
       <location>/path/to/error/document.html</location>
    </error-page>

    For best practices, the application should handle its own errors.  

    Regards, Brian