Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit ad3b8d7

Browse files
committed
chore(docs/.htaccess): bundle .htaccess with docs
1 parent 3ea2416 commit ad3b8d7

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

docs/src/gen-docs.js

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var writes = callback.chain(function(){
2727
writer.copyDir('img', writes.waitFor());
2828
writer.copyDir('examples', writes.waitFor());
2929
writer.copyTpl('index.html', writes.waitFor());
30+
writer.copyTpl('.htaccess', writes.waitFor());
3031
writer.copy('docs/src/templates/index.html', 'build/docs/index-jq.html', writes.waitFor(),
3132
'<-- jquery place holder -->', '<script src=\"jquery.min.js\"><\/script>');
3233
writer.copyTpl('offline.html', writes.waitFor());

docs/src/templates/.htaccess

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Options +Indexes
2+
IndexIgnore favicon.ico
3+
RewriteEngine on
4+
5+
# Enable Crawling of AJAX apps.
6+
# See: http://code.google.com/web/ajaxcrawling/docs/getting-started.html
7+
RewriteCond %{QUERY_STRING} ^_escaped_fragment_=\/(.*)$
8+
RewriteRule ^(.*)$ /$1/%1.html?
9+
10+
# Map versiond angular files to root folder.
11+
RewriteRule ^angular([\-\w]+)(\d+\.\d+\.\d+)(.*)$ /$2/angular$1$2$3
12+
# Map 1.2.3/docs to 1.2.3/docs-1.2.3/ so that we don't need the version in the URL twice
13+
RewriteRule ^(\d+\.\d+\.\d+)/docs/(.*)$ /$1/docs-$1/$2
14+
15+
# If the user has forgot the trailing slash than add it through redirect
16+
RewriteRule ^latest$ /latest/ [R]
17+
RewriteRule ^latest/docs$ /latest/docs/ [R]
18+
19+
# To change the latest version just change this line.
20+
# IMPORTANT: the order of lines matters, do not move to top!
21+
RewriteRule ^latest/(.*)$ /0.9.17/$1
22+
23+
# If the request comes on http://docs.angularjs.org then point it to latest/docs
24+
RewriteCond %{HTTP_HOST} ^docs\.angularjs\.org$
25+
RewriteCond %{REQUEST_URI} !^/\d+\.\d+\.\d+
26+
RewriteCond %{REQUEST_URI} !^/latest
27+
RewriteCond %{REQUEST_URI} !^/angular-
28+
RewriteCond %{REQUEST_URI} !^/favicon.ico
29+
RewriteRule ^(.*)$ /latest/docs/$1
30+
31+
## PERFORMANCE ##
32+
33+
ExpiresActive On
34+
35+
# cache js files for one year
36+
<FilesMatch "^angular-(ie-compat-)?[\d\.]+(\.min)?\.js">
37+
ExpiresDefault "access plus 1 year"
38+
</FilesMatch>
39+
40+
# don't cache appcache manifests
41+
<FilesMatch "\.manifest$">
42+
ExpiresDefault "access"
43+
</FilesMatch>
44+
45+
# cache everything else for 1h
46+
ExpiresDefault "access plus 60 minutes"
47+
48+
49+
# compression
50+
SetOutputFilter DEFLATE
51+
Header set Vary "Accept-Encoding"
52+
53+
54+
# content types
55+
AddType application/javascript js
56+
AddType text/cache-manifest .manifest
57+

0 commit comments

Comments
 (0)