I'm in the process of transferring a bunch of content from one website
, and when I'm done, I want to make a script which will automatically forward users from the old website to the new, and not only that, but to the piece of content that they were trying to access on the old server.
I'm currently thinking I'll do it this way:
- remove all of the content from the old site
- make the 404 file not found errordoc file point at a CGI script
- that 404.pl script will look at the filename they were trying to access, and do a fuzzy lookup of it in a hash of all the filenames in the new website's document tree.
- If there's a perfect match, then they'll just be forwarded seamlessly, if there are several matches, they'll get the list, along with the text fromt he DESCRIPTION meta-tag in the file
This seems like such a useful thing, that I am suspicious it may have already been written. I haven't been able to find it though. Does anyone know if it exists? Does anyone have suggestions for making it work better, or see problems with the idea?
It would also work well for correcting typos or making broken links work, within a site. e.g. I move a file to a new directly, but forget to update some of the links. Someone follows the one of the old links, and, since the file still has the same name, the 404.pl script finds it and instantly forwards them, and they never see an error. (If it works, this could lead to great laziness on my part...)
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.