Don't break existing links!

Michael Nahrath gpgweb-devel@nahrath.de
Fri, 06 Dec 2002 16:38:08 +0100


George Pauliuc <pauliuc@gmx.net> schrieb am 2002-12-06 15:26 Uhr:

> On Vi, 2002-12-06 at 11:50, Lorenzo Cappelletti wrote:
>> I know of 3 methods for redirection:
>> 
>> 1. symbolic links
> 
> As you said, it has one big minus - everybody will think that is the
> same page.  When it isn't.

> If you'd use some server-side scripting it
> might be one solution to make two includes: first, one with an
> anouncement like "the new page is at..." and second the actual page.

There is no special announcement to the user neccesary.
Sending http: error code 301 _is_ the announcement to the UserAgent.

No need to bother the user with this. "Don't mention the mechanics!"

But bringing up server side scripting can lead to another recommendable
solution. 
Some scripting languages are able to send fully correct HTTP-headers too.

If you have cgi:

#!/usr/bin/perl
print "Status: 301 Moved Permanently\n";
print "Location: http://www.gnupg.org/documentation/";
print "Content-type: text/html\n\n";
# The following normaly is never seen if Browsers understand HTTP correctly
print "<title>Page has mooved</title>\n";
print "<p>New location: <a href="http://www.gnupg.org/documentation/">
                            http://www.gnupg.org/documentation</a>\n";

Or

#!/bin/sh
echo 'Status: 301 Moved Permanently'
echo 'Location: http://www.gnupg.org/documentation/'
echo 'Content-type: text/html'
echo
echo <title>Page has mooved</title>
echo <p>New location: <a href="http://www.gnupg.org/documentation/">
                            http://www.gnupg.org/documentation</a>

The server configuration problem in both cases would be to make it parse cgi
for the URL <http://www.gnupg.org/docs.html>


If you have PHP it would be something like

<?php 
header("Status: 301 Moved Permanently");
header("Location: http://www.gnupg.org/documentation/")
header("Content-Type: text/html");
echo '<title>Page has mooved</title>';
echo '<p>New location: <a href="http://www.gnupg.org/documentation/">
                            http://www.gnupg.org/documentation</a>'
?>

Again in Apache this could be easyly activated for /docs.html by a line in
the .htaccess file

    AddType application/x-httpd-php .html


[Please don't think I understand anything about perl and shell scripting!
 I made these up by a fiend's help once. That's all I have.]

>> 2. meta tag time-out redirection
> 
> It isn't portable as long as you give the full URL
> "http://www.gnupg.org/path/to/your/file.html".  If you use something
> like "./new/directory/file.html" or "../../directory/file.html" should
> work well with mirrors as well.

I fear you can't do this.

Keep in mind that the <meta http-equiv="..."> is nothing
but a second class trial to give the Browser information
that belongs to the HTTP Header after you have missed to
do it in the right place!

At least you are bound to keep keep HTTP specs for its content.
Relative adressing is not known there.

Maybe Browsers would expand the relative URL to a fully qualified one if
they get it via <meta http-equiv="..."> but I am not shure about this.
 
>> 3. web server configuration
> 
> This is a no IMHO as you have such a clean code right now and tend to
> follow the standards meaning portability.

IIUC negotiating <http://www.gnupg.org/documentation/index.html.de to
http://www.gnupg.org/(de)/documentation/index.html is a Caudium only
"feature". That will make portability to other servers a problem anyway.

And as Werner stated:
Broken links may probabliy not be a big problem on mirror sites.

Greeting, Michi