Custom 404 for you

| 0 Comments | 0 TrackBacks
Since 6 a.m. this morning, any attempts to use a custom 404 File Not Found error for your Penn State Personal Web site for URL requests like:

  • http://www.personal.psu.edu/xyz123/badurl
will now work.  Previous to this change, they would fall through to the server-wide default 404 error page.

In contrast, requests for URLs like:

  • http://www.personal.psu.edu/users/x/y/xyz123/badurl
didn't have a problem and will continue to work.

An example of how to set a custom 404 File Not Found error page is to create the page you want visitors to see at a page like http://www.personal.psu.edu/xyz123/404error.html, then add the following line to .htaccess:

ErrorDocument 404 /xyz123/404error.html

The error page filename can be anything you want. Change the userid to match yours.

The problem was that the RewriteRules had to determine if a file or folder matching the short (trie-less) URL belonged to a userid that matched the pattern.  It did this through a "does the file exist?" (-f) test.  This would prevent mismatches for hits that should be local to the DocumentRoot such as /users/i/m/images/lion.gif.  However, this precluded the ability for a user to use a custom 404 error for the the short URL version of their space.  The new way performs a folder exists (-d) RewriteCond test on the user's home folder, allowing that user to claim any URL requests for that space (custom 404 or not).  Prior to Feb 21, 2006, this was never a problem, since we used to force an external [R] redirect before the 404 condition would be reconsiled.

In retrospect, I am tempted to declare my old RewriteRules for www.personal.psu.edu sloppy, since there were other inefficiencies corrected this morning, but I guess such judgment comes with experience using them.  They certainly are "D*** cool voodoo".

No TrackBacks

TrackBack URL: https://blogs.psu.edu/mt4/mt-tb.cgi/68927

Leave a comment

Search This Blog

Full Text  Tag

Recent Entries

Kerberos encryption types augmented
On Wednesday, January 6, 2010, we augmented the list of encryption types supported by the Access Account realm, dce.psu.edu, to…
Database behind Blogs (and other things) upgraded today
http://alerts.its.psu.edu/alert-1278 ran without a hitch.  Yes, this post is part of the verification. ;-)…
Samba server upgrade
Starting October 20th, and ending this morning, we upgraded each of the 6 Samba (SMB/CIFS) PASS Gateways.  They now have…