Solved

Create A Centralized Redirect Using JSP

Posted on 2004-04-07
9
253 Views
Last Modified: 2010-04-01
Problem:
We have recently redesigned/reorganized our website (approximately 60,000 pages, http://www.wicourts.gov).  We have a large user base (basically the entire state of Wisconsin), who have bookmarked various pages on the old website.  As a courtesy to our customers, we want to have a centralized redirection system, that way we don't have to create a zillion different redirection pages.  In addition, we want the user to know that the page no longer exists and that they are being redirected to a new page (thus giving them the opportunity to update their bookmarks).

Possible Solution:
One solution that I have come up with is having one JSP page that accepts 2 parameters (the original page and the new page).  Since we are using Apache, we can setup redirects for a particular page that redirects the user to the JSP page (obviously passing the appropriate parameters), waits 5-10 seconds, and then sends them to the appropriate page.  The parameters will be used to display information back to the user and assist in redirecting to the new page (I hope that makes sense).

The Challenge:
Although the solution above might work, I wanted to pose the question to this community to get some various feedback.  I could very well just do a simple redirect using Apache and be done with it, but that does not prompt the user to update their bookmarks.  I could have also created the zillion pages and do the redirect that way as well... but that would be very labor intensive.  Has anyone else had to do something similar?  If so, how did you accomplish the task?

The best response get the max points...
0
Comment
Question by:kirbinator
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10780213
the approach you are proposing sounds reasonable. How are u storing the redirect mappings?
0
 

Author Comment

by:kirbinator
ID: 10780482
I was just going to add the redirects in the query string within the httpd.conf file.  Something like this

Redirect "/somedir/index.html" "/redirect.jsp?referring=/somedir/index.html&new=/newdir/index.html"

Do you know (or think) of a better way?

0
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 10780516
if you stored them in a db for example then all the redirecting jsp would need would be the old url.
u could then perhaps just redirect all missing pages which could lookup whether a redirect existed, and perform it if so.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 7

Assisted Solution

by:searlas
searlas earned 125 total points
ID: 10781466
If this is a reorganization (as you say), you should seriously consider RedirectPermanent and or 'RedirectMatch permanent', this allows some browsers to automatically update their Favorites/bookmarks without user intervention.
0
 
LVL 5

Assisted Solution

by:KarcOrigin
KarcOrigin earned 125 total points
ID: 10781539
Hi,

This is just an idea. Can you afford using XML mappings? Actually you need a controller JSP/Servlet which just read the XML file fetch the action (which is your old URLs in your case) mapped with the redirection page URL. By combining this approch you would never need to complie or change anything on JSP in future also. Just change the XML file which stores the mapping of actions and their corresponding redirection URL.

You can even avoid to restart your server once you change anything in the XML file. I hope this may give you some idea and the beauty of using XML as a redirection center of gravity. It is also better if you map your future "new URLs" with the "new actions" (It is just a suggestion)

Thx
0
 
LVL 19

Assisted Solution

by:Kuldeepchaturvedi
Kuldeepchaturvedi earned 125 total points
ID: 10782927
Have you thought of using a filter servlet???
you will have to update your web.xml to have a filter setting on the web application.....

so automatically every request to your web site will go to this filter..

now this filter can choose any method to find the new page (either database,XML, or anything else that you might come up with to store the redirection mappings)..

All this filter will do is to read this mapping and redirect appropriately....

I know I am giving quite sketchy details here, but we can start and build as we go..

Regards
0
 
LVL 1

Expert Comment

by:KartikShah
ID: 10919316
One option, if you are using is, that you can keep a redirect map either in memory or the DB.

Remove all the old files from the system, and in the web.xml, for a 404 error forward the request to the redirect JSP that will check whether .. the requested url is an old url or not.

If it is an old URL, you can redirect it to the correspoding new page using the redirect map, or else you can display the 404 error. :)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
default methods vs abstract class 1 118
best way to search/remove a file from an EAR file 3 112
main method of string class 3 117
how to debug htl and js pages 8 38
If you are looking at this article, you have most likely been hit by some version of ransomware and are trying to find out if there is anything you can do, or what way you should react - READ ON!
Some of the SEO trends we might expect in 2017.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question