1 [[!meta title="Can I set up my scripts site to forward/redirect to another website?"]]
2 Yes. If you would like to redirect all web requests for a given URL
3 on scripts.mit.edu to another website (such as web.mit.edu), follow
6 **Note:** These directions are only appropriate for redirecting a
7 URL on your scripts.mit.edu site to another URL that is **not**
8 also on your scripts site. If you want to, for example, cause
9 http://mylocker.scripts.mit.edu to take people to
10 http://mylocker.scripts.mit.edu/wiki, please skip to the directions
11 at the end of the page.
13 \1. Create a directory for the redirect. In these examples, we will
14 be redirecting http://mygroup.scripts.mit.edu/subpage/ to
15 http://www.example.com/other/website/, so create the “subpage”
17 athena% **attach**mygroup
18 athena% **mkdir /mit/**mygroup**/web\_scripts/**subpage
20 \2. Create a text file named .htaccess within your the new
22 athena% **cd /mit/**mygroup**/web\_scripts/**subpage
23 athena% **emacs .htaccess**
25 \3. Place two lines like the following in the .htaccess file:
26 **RedirectPermanent /\~**mygroup**/**subpage**/**
27 http://www.example.com/other/site/
28 **RedirectPermanent /**subpage**/**
29 http://www.example.com/other/site/
30 This will send requests to either
31 http://scripts.mit.edu/\~mygroup/subpage/ or
32 http://mygroup.scripts.mit.edu/subpage/ to the right address. It
33 will also redirect, e.g.,
34 http://mygroup.scripts.mit.edu/subpage/foo.html to
35 http://www.example.com/other/site/subpage/foo.html.
37 If you would like the redirect not to be cached by web browsers
38 (e.g.,if you’re planning to change the redirect or set up a scripts
39 site at this address), use “RedirectTemp” instead of
42 If you’re also planning to get a
43 [mygroup.mit.edu-style address](/faq/14/) (a CNAME) to redirect to
44 an outside site, then add at the bottom
45 **RedirectPermanent /** http://www.example.com/other/site/
47 If, instead of redirecting visitors to a different website, you
48 wish to cause visitors who go to http://mylocker.scripts.mit.edu to
49 be redirected to http://mylocker.scripts.mit.edu/wiki (or something
50 similar), you can do the following:
52 \1. Create a text file named .htaccess in your locker’s
53 web\_scripts directory (or edit an existing one), e.g.:
54 athena% **cd /mit/**mylocker**/web\_scripts**
55 athena% **emacs .htaccess**
57 \2. Place a line like the following near the top of the .htaccess
59 **RedirectMatch \^/?$** /wiki
60 This will only send requests to http://mylocker.scripts.mit.edu to
61 the initial address for the wiki. It will not interfere with the
62 way the rest of your existing URLs work.
64 More information about redirect rules is available in the
65 [Apache documentation](http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect).
68 [set up your web.mit.edu or www.mit.edu site to forward to scripts](http://scripts.mit.edu/faq/54).