How to redirect a RawGit URL to another URL or GitHub file
To have RawGit respond to requests for a file with an HTTP redirect to another file or URL, create a file containing a redirect directive. Requests for this file will be redirected to the specified URL, which may be either relative or absolute.
Note: This feature only applies to files served via
rawgit.com. For performance reasons, it isn't currently supported for files served via
!rawgit-redirect <url> [301|302];
A redirect directive consists of the UTF-8 text
!rawgit-redirect followed by a relative or absolute URL and optionally an HTTP response code, separated by spaces and ending with a semicolon. The response code, if specified, may be either
301 (for a permanent redirect) or
302 (for a temporary redirect). If the response code is omitted, it will default to
The directive must occur at the beginning of the file (disregarding whitespace), and must fit entirely within the first 1,024 bytes of the file.
Example: Temporary Redirect
To temporarily redirect the file
foo.js to another file named
bar.js, replace the contents of
An absolute URL will also work. Absolute URLs may begin with "http://", "https://", or "//". The latter will use either HTTP or HTTPS, depending on the protocol of the original request.
Example: Permanent Redirect
To permanently redirect a file and instruct clients to cache the redirect forever, specify a
301 response code after the URL:
!rawgit-redirect bar.js 301;