Go to the Stanford University web site
Log In
(To add something to the Commons.)

Web Development

Redirect from AFS to sites.stanford.edu and exclude one directory

We have recently moved a website from /afs/ir/group/name-of-group/ to sites.stanford.edu platform with url http://new-name.stanford.edu and we wanted to redirect everything from old site to new site, except forms that are built using Form Builder.

I wanted to share our code for those who are following the same trail...

RewriteEngine On

RewriteCond %{REQUEST_URI} !/group/name-of-group/forms [NC]
RewriteCond %{HTTP_HOST} !new-name.stanford.edu$ [NC]
RewriteRule ^(.*)$ http://new-name.stanford.edu/$1 [L,R=301]

How to Tell if you are using a Reverse Proxy

To determine whether your virtual host / subdomain is hosted on the WWW servers or on the proxy servers (legacy), run the following comman on the command line:

host myvanityurl.stanford.edu
from a Terminal window.
If it returns:
then it's on the proxy servers.
If it returns:
then it's on the www servers.

Website Redesign Checklist


This checklist is intended to help small departments assess their needs for website re-design and leverage as many Stanford and low-cost opportunities as possible.

The "Roles" section lists all of the potential roles in an ideal redesign. Some of these are areas of focus rather than actual job titles, but each could easily take up a great deal of time. With a small staff, some individuals will fulfill several roles, and some roles will be filled by outsiders.

Direct PHP errors to a log file of your choosing

Thanks to John Bickar for the code below.

Developers working with sites on www.stanford.edu don’t get direct access to Apache’s error log. To troubleshoot your PHP applications, you can create a local php.ini file with the lines below. This will redirect PHP errors to a file of your choosing. Make sure to remove these lines and the file containing the errors once you are done troubleshooting to avoid disclosing the internal workings of your application.

Show git branch in bash prompt

It's considered good practice to create feature branches in git when working on new functionality. The problem with this is that knowing which branch you are in is not obvious. Pasting the following into your .bashrc file will display the current branch in your prompt.

Simple Git Fast Forward

If you get the befuddling message:

Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded

you can just run:

git pull

Or, if that doesn't work:

git pull origin master

(I think.)

The above might seem obvious to some, but Googling "git fast forward" proved surprisingly unfruitful. HTH.



Boost "provides static page caching for Drupal enabling a very significant performance and scalability boost for sites that receive mostly anonymous traffic". With the move of proxies to the WWW servers (January 2012), it is possible to install and configure it in the Stanford Leland web environment.

Benchmarking Site Performance with ApacheBench

ApacheBench (ab) is "a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server." It is built in to most current versions of Mac OS X and Linux. It's a quick way of sending multiple requests to a website and timing how long they take.

Basic Test

At its most basic, ab can perform successive and/or concurrent load tests on a webpage. Run the following command in the Terminal (Mac OS X; if you don't have OS X, ab is installed on the corn cluster machines):

Qualitative Website Usability Testing

A couple of months back we'd posted to su_webmasters asking for advice / suggestions / ideas for conducting web usability tests. We're grateful for all the suggestions we received -- thank you for those!

We wanted to follow up with a quick recap of what we ended up doing, and how it went.

Conduct qualitative usability testing on our ECorner website (ecorner.stanford.edu) to gain insights on the general usability of the UI.

Virtual Host for Foswiki / TWiki wikis

Using a vanity URL / virtual host address like http://mysub.stanford.edu with a Foswiki is pretty straightforward. Assuming that your Foswiki installation's view script is at http://www.stanford.edu/path/to/cgi-bin/wiki/bin/view, then