Forums Register Login

Redirection and 404 Error

+Pie Number of slices to send: Send
Hello,
I have 2 problems:
1. I need to do a redirection for my website in the following manner. How should I do it? I am using Tomcat server. Please note that there are urlrewrite.xml and web.xml files present on the server.
Current view: www.mydomain.com/blog/12345678
I want this to appear like: www.mydomain.com/blog/this-is-the-title-of-blog.html


2. I tried entering this code for 404 redirection towards my home page. But it does not work. How should I correct it?
<error-page>
<error-code>404</error-code>
<location>/index.jsp</location>
</error-page>

Thanks for helping me.
+Pie Number of slices to send: Send
Welcome to Javaranch.

Do you run on Spring or that urlrewrite.xml is something your code reads? I am not sure what you are trying to accomplish with a 404 (not found) and a redirect. Are you probably trying to do something like showing a 404 error and then redirecting to the new location?
+Pie Number of slices to send: Send
Hello,
There are two different things. I do not want to mix them.

In general there is no 404 error page coded for the website. So I want to redirect all users to index page in case 404 error happens.

For redirects it is another issue... not related to 404.
All redirects are mentionned in the urlrewrite.xml file. and I want to create a new redirect as mentioned above.

Thank you!
+Pie Number of slices to send: Send
Check the location of your index.jsp. It should be relative to the web app. In your case it should be inside your home web app folder..

On top of spaghetti all covered in cheese, there was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 741 times.
Similar Threads
Problems with jsp-error page in web.xml
Error Redirection w/Params?
Need suggestion
JSF : redirect errors to error page
404 error redirecting
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:16:48.