See also Rewrite Rules.

There are two primary places where redirects for URLs happen:

  1. In the Apache configuration files.
  2. In the website-specific redirects.php file.
You are better off using the Apache configuration files because the matching is more likely to work.

In the Apache configuration files

Which configuration file is used for redirects varies between sites.

The configuration files are in /usr/local/apache/conf or possibly /usr/local/apache/conf/extra/httpd-vhosts.conf.

To determine which file is used, look in /usr/local/apache/conf/extra/httpd-vhosts.conf.

e3s

For example, the e3s section in /usr/local/apache/conf/extra/httpd-vhosts.conf starts with:


    #ServerName hsn.eecs.berkeley.edu               
    ServerName www.e3s-center.org
    DocumentRoot /home/www/e3scenterwww
At some point, that section includes:
    # E3S Redirects.  See /home/www/php/e3scenter.org/redirects.php   
    # If you edit this, add the shortest redirects at the end.   
    # To tell apache about your changes, as root run /etc/init.d/apachectl graceful  
    RewriteRule /about.htm$  /about/index.htm [R,L]
    RewriteRule /education/2014-E3SREU-Recommendation$ /education/2014-E3SREU-Recommendation-Letter-Form.pdf [R,L]
    RewriteRule /education/2014-ttereu-recommendation$ /education/2014-TTEREU-Recommendation-Letter-Form.pdf [R,L]
    RewriteRule /education/2013_tte-reu_$ /education/2013_TTE-REU_Flyer2.pdf [R,L]
    RewriteRule /education/2013_$ /education/2013_TTE_XEnroll_Flyer.pdf [R,L]

    # Redirect the symposium    
    RewriteRule /symposium$  /events/e3s-symposium/index.htm [R,L]
    RewriteRule /symposium/$  /events/e3s-symposium/index.htm [R,L]
    RewriteRule /symposium.htm$  /events/e3s-symposium/index.htm [R,L]



    # Needed for mod_jk 1.2.26 and later   
    # see http://embedded.eecs.berkeley.edu/dopsysadmin/faq/72.html          
    JkMountCopy On

    # This can't just be included once at the top.  It must be in each  
    #  context:                           
    Include "/usr/local/apache/conf/rewrite.conf"
The first part adds e3s-specific redirects. The Include "/usr/local/apache/conf/rewrite.conf" line includes redirects that are general to all the websites that have workgroups. Note that /usr/local/apache/conf/rewrite.conf does have some website-specific redirects for wikis and other pages.

Static Sites

Sites that don't have workgroups, such as hi-cons, have the following in /usr/local/apache/conf/extra/httpd-vhosts.conf:
Include "/usr/local/apache/conf/rewrite-static.conf"
You can either add redirects to the appropriate section of /usr/local/apache/conf/extra/httpd-vhosts.conf or you can add them to /usr/local/apache/conf/rewrite-static.conf.

Adding them to the section of /usr/local/apache/conf/extra/httpd-vhosts.conf is preferred because it means that not all the sites are sharing the same redirects.

Editing the Apache configuration files

After editing any of the above Apache configuration files, be sure to run
/etc/init.d/apachectl graceful

In the website-specific redirects.php file

Each workgroup has a separate redirects.php file, on moog, for the e3s file, see ~www/php/e3scenter.org/redirects.php

NOTE: it will not work if you try to redirect "foobar" to "foobarbif.htm" in redirects.php - you will get a loop of redirects. Instead, use the Apache configuration above.