See also Rewrite Rules.
There are two primary places where redirects for URLs happen:
You are better off using the Apache configuration files because the matching is more likely to work.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
.
For example, the e3s section in /usr/local/apache/conf/extra/httpd-vhosts.conf
starts with:
At some point, that section includes:#ServerName hsn.eecs.berkeley.edu ServerName www.e3s-center.org DocumentRoot /home/www/e3scenterwww
# 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 #The first part adds e3s-specific redirects. Thecontext: Include "/usr/local/apache/conf/rewrite.conf"
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.
/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.
/etc/init.d/apachectl graceful
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.