]> scripts.mit.edu Git - www/raw.git/blob - faq/54.mdwn
Import from TextPattern
[www/raw.git] / faq / 54.mdwn
1 [[!meta title="How do I redirect visitors from my web.mit.edu or www.mit.edu URL to my scripts.mit.edu website?"]]
2 URLs on web.mit.edu (e.g., http://web.mit.edu/jbarnold/ or
3 http://web.mit.edu/\~jbarnold/, the tilde is optional) point to the
4 top level of your Athena locker (/mit/jbarnold in this case).
5
6 URLs on www.mit.edu (e.g., http://www.mit.edu/\~jbarnold/, the
7 tilde is required) point to the www subdirectory of your Athena
8 locker (/mit/jbarnold/www).
9
10 If you want visitors to your web.mit.edu or www.mit.edu URL to see
11 your scripts site instead, first, cd to the directory corresponding
12 to your web.mit.edu or www.mit.edu URL (for example, my directory
13 /mit/jbarnold/www corresponds to the URL
14 http://www.mit.edu/\~jbarnold):
15
16 athena% **attach jbarnold**  
17 athena% **cd /mit/jbarnold/www**
18
19 Next, create a **.htaccess.mit** file in this directory and add
20 rewrite rules to it. For example, if I wanted to redirect both
21 **http://www.mit.edu/\~jbarnold/** and
22 **http://web.mit.edu/jbarnold/www** to
23 **http://jbarnold.scripts.mit.edu**, I would add the following two
24 lines:
25
26 **Redirect 301 /\~jbarnold http://jbarnold.scripts.mit.edu**  
27 **Redirect 301 /jbarnold/www http://jbarnold.scripts.mit.edu**
28
29 The first line handles redirecting http://www.mit.edu/\~jbarnold to
30 http://jbarnold.scripts.mit.edu and the second line (which is
31 completely independent) handles redirecting
32 http://web.mit.edu/\~jbarnold to http://jbarnold.scripts.mit.edu.
33
34 Finally, if you placed this in your locker, rather in the www
35 subdirectory, you may need to give the web.mit.edu server access to
36 your locker, so it can read your .htaccess.mit file (warning: this
37 will also cause all the files in your locker to be readable over
38 web.mit.edu):
39
40 athena% **fs sa . system:htaccess.mit read**
41
42 You should check that the redirect is working, and that people
43 cannot read your personal files via web.mit.edu (e.g.,
44 http://web.mit.edu/jbarnold/).
45
46 You can find more information about .htaccess files and Apache
47 Redirect rules via Google. IS&T has a
48 [website about .htaccess.mit files](http://web.mit.edu/ist/web/reference/web-resources/https.html),
49 but it focuses on restricting content, not redirects. If you have
50 questions about how you should set up your .htaccess.mit file, feel
51 free to contact us by e-mailing scripts@mit.edu.
52
53 You can also
54 [redirect visitors from your scripts.mit.edu site to another website](http://scripts.mit.edu/faq/63).
55
56
57