scripts.mit.edu

MIT SIPB Script Services for Athena

Can I set up my scripts site to forward/redirect to another website?

Yes. If you would like to redirect all web requests for a given URL on scripts.mit.edu to another website (such as web.mit.edu), follow these instructions:

Note: These directions are only appropriate for redirecting a URL on your scripts.mit.edu site to another URL that is not also on your scripts site. If you want to, for example, cause https://mylocker.scripts.mit.edu to take people to https://mylocker.scripts.mit.edu/wiki, please skip to the directions at the end of the page.

1. Create a directory for the redirect. In these examples, we will be redirecting https://mygroup.scripts.mit.edu/subpage/ to https://www.example.com/other/website/, so create the “subpage” directory:
athena% attach mygroup
athena% mkdir /mit/mygroup/web_scripts/subpage

2. Create a text file named .htaccess within your the new directory, e.g.:
athena% cd /mit/mygroup/web_scripts/subpage
athena% emacs .htaccess

3. Place two lines like the following in the .htaccess file:
RedirectPermanent /~mygroup/subpage/ https://www.example.com/other/site/
RedirectPermanent /subpage/ https://www.example.com/other/site/
This will send requests to either https://scripts.mit.edu/~mygroup/subpage/ or https://mygroup.scripts.mit.edu/subpage/ to the right address. It will also redirect, e.g., https://mygroup.scripts.mit.edu/subpage/foo.html to https://www.example.com/other/site/subpage/foo.html.

If you would like the redirect not to be cached by web browsers (e.g.,if you’re planning to change the redirect or set up a scripts site at this address), use “RedirectTemp” instead of “RedirectPermanent.”

If you’re also planning to get a mygroup.mit.edu-style address (a CNAME) to redirect to an outside site, then add at the bottom
RedirectPermanent / https://www.example.com/other/site/

If, instead of redirecting visitors to a different website, you wish to cause visitors who go to https://mylocker.scripts.mit.edu to be redirected to https://mylocker.scripts.mit.edu/wiki (or something similar), you can do the following:

1. Create a text file named .htaccess in your locker’s web_scripts directory (or edit an existing one), e.g.:
athena% cd /mit/mylocker/web_scripts
athena% emacs .htaccess

2. Place a line like the following near the top of the .htaccess file:
RedirectMatch ^/?$ /wiki
This will only send requests to https://mylocker.scripts.mit.edu to the initial address for the wiki. It will not interfere with the way the rest of your existing URLs work.

More information about redirect rules is available in the Apache documentation.

You can also set up your web.mit.edu or www.mit.edu site to forward to scripts.

Previous:
Next:
© 2004-2020, the SIPB scripts.mit.edu project.
These pages may be reused under either the GFDL 1.2 or CC-BY-SA 3.0.
Questions? Contact scripts@mit.edu.

You are currently connected to cats-whiskers.mit.edu.