[sf-lug] BALE updates (CCSF Linux Users Group ... 302 ... 301 ... JavaScript ...)
Michael Paoli
Michael.Paoli at cal.berkeley.edu
Wed Feb 18 03:19:08 PST 2015
> From: "Rick Moen" <rick at linuxmafia.com>
> Subject: Re: [sf-lug] BALE updates
> Date: Tue, 10 Feb 2015 00:41:52 -0800
>
> Quoting Daniel Gimpelevich (daniel at gimpelevich.san-francisco.ca.us):
>
>> Not sure where you got the URL you've now put in that table for CCSF
>> LUG's website, but it's a 404. It's canonically www.ccsf.edu/lug
>
> The URL I had was valid just a couple of days ago.
>
> http://www.ccsf.edu/lug is a 302 temporary redirect to
> http://www.ccsf.edu/Organizations/Linux_Users_Group , which is a 301
> permanent redirect to
> http://www.ccsf.edu/Organizations/Linux_Users_Group/ . That page then
> does a Javascript redirect to http://hills.ccsf.edu/~lug/index.html .
>
> I'm not sure why you are saying that, of that clusterfsck of redirects,
> www.ccsf.edu/lug is canonical. ;->
>
> But what the hell, I'll quote www.ccsf.edu/lug . It's at least short.
Uhm, well ...
At least in theory ;-) ... 302 redirect being "temporary" and all that,
that's supposed to also be "signal" to humans, 'bots, and stuff that
might otherwise automagically update bookmarks to *not* updated the URL,
but keep the original, and follow it ... as where it redirects to may
change - or the content may end up back at the head of that trail.
So ... I'd be inclinded to use/note/record the
http://www.ccsf.edu/lug
(though it might also be prudent to also record and note the others
... "just in case" ... but I wouldn't be inclined to "advertise" or
promote the others ... unless/until http://www.ccsf.edu/lug became
highly broken).
But then there are also some, uhm, slightly more interesting bits ...
301 - well, that's "permanent", so stuff hitting that should update;
wouldn't typically want/expect a 301 in a chain starting with a 302.
However, if we look wee bit more closely at that 301:
$ curl -s -I http://www.ccsf.edu/Organizations/Linux_Users_Group |
> grep '^[HL]'
HTTP/1.1 301 Moved Permanently
Location: http://www.ccsf.edu/Organizations/Linux_Users_Group/
$
That looks most likely to just be a generic redirect by the web server,
Essentially client says gimme:
host:www.ccsf.edu file: Organizations/Linux_Users_Group
And web server says, "Duh, that's a *directory*, not a file,
you almost certainly really want:
host:www.ccsf.edu directory:Organizations/Linux_Users_Group/
and I'm gonna tell you it's permanently moved, and you go update
yourself about that, and don't bother asking me for the incorrect
thing again, 'cause I just told you what you ought ask for.
... so, the error there is really upstream, that 302 ought be to:
http://www.ccsf.edu/Organizations/Linux_Users_Group/
rather than:
http://www.ccsf.edu/Organizations/Linux_Users_Group
But wait, there's more ;->
Egad, JavaScript, ... whatever, ... but, ... if one's client doesn't
use JavaScript, or has it disabled, we see (yes, I tried it also with
lynx) ...
$ wget -q -O - http://www.ccsf.edu/Organizations/Linux_Users_Group/ |
> fgrep not\ load
<p>If page does not load, click <a
href="http://hills.ccsf.edu/~lug/lug/index.html">here</a></p>
$
Ah, ... but
http://hills.ccsf.edu/~lug/lug/index.html
gives a 404 ... oops.
Apparently that was intended to be:
http://hills.ccsf.edu/~lug/index.html
as we see in part of all that JavaScript goop:
$ wget -q -O - http://www.ccsf.edu/Organizations/Linux_Users_Group/ |
> fgrep window
window.location = "http://hills.ccsf.edu/~lug/index.html"
$
And too, really, why /index.html ? Generally better to just use /,
that way if it changes (e.g. one later uses index.htm or index.php or
what have you), then browsers' bookmarks, search engines, etc.
will have noted URL ending with /, rather than index.html
In fact, e.g. on BALUG's site, most URLs where someone gives an
/index.html at the end, redirect to just /, just to avoid those
potential issues (and to also concentrate the "link juice" behind
generally single canonical URLs, rather than various alternative
URLs that provide the exact same content). Similar is also
done with BALUG for the "host" name part of the URL.
Canonicalizes to www.balug.org (if given without the leading www. - also
not to be confused by other sites/hosts under the balug.org domain).
So, yes CCSF Linux Users Group ... ideally, if one is going to have
one or more redirects there, and the first is intended to be the
canonical (not necessarily ideal, but sometimes the best
available for a given situation or infrastructure), then the first would
be 302, it should redirect to the canonical form of the 2nd - to avoid
the intermediary 301 (!) and the overhead of that additional otherwise
totally unnecessary redirect. And that JavaScript ... ugh, well, anyway,
if it needs to be used or whatever, in any case, the alternate link for
those not running JavaScript should be correct, rather than broken/404,
and would probably be much better to change those /index.html to just
/, and then also 301 redirect the /index.html to just / (and likewise any
redirects point to tagets with the ending index.html dropped, to just
leave the preceding / before it).
But hey, they're (presumably mostly or entirely) students, ... they gotta
learn this stuff. :-)
More information about the sf-lug
mailing list