| 1 |
# Set index.n to come before index.php |
| 2 |
|
| 3 |
DirectoryIndex index.n index.php index.html |
| 4 |
|
| 5 |
RewriteEngine On |
| 6 |
|
| 7 |
# Redirect http to https |
| 8 |
RewriteBase / |
| 9 |
RewriteCond %{HTTPS} !=on |
| 10 |
RewriteCond %{HTTP:X-Forwarded-Proto} !https |
| 11 |
RewriteCond %{HTTP_HOST} !^localhost(:[0-9]+)?$ |
| 12 |
RewriteCond %{REQUEST_URI} !index\.n/?$ |
| 13 |
RewriteCond %{REQUEST_URI} !^/api/ |
| 14 |
RewriteCond %{REQUEST_URI} !^/files/ |
| 15 |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,QSA] |
| 16 |
|
| 17 |
# /files are stored in S3 |
| 18 |
|
| 19 |
# for recent versions of haxelib client, which send UA, use https, and support redirection |
| 20 |
RewriteBase / |
| 21 |
RewriteCond %{HTTPS} =on [OR] |
| 22 |
RewriteCond %{HTTP:X-Forwarded-Proto} =https |
| 23 |
RewriteCond %{ENV:HAXELIB_CDN} !^$ |
| 24 |
RewriteCond %{HTTP_USER_AGENT} !^$ |
| 25 |
RewriteRule "^files/(.*)$" "https://%{ENV:HAXELIB_CDN}/files/$1" [L,R=302] |
| 26 |
|
| 27 |
# for older versions of haxelib client |
| 28 |
RewriteBase / |
| 29 |
RewriteCond %{REQUEST_FILENAME} !-f |
| 30 |
RewriteCond %{ENV:HAXELIB_CDN} !^$ |
| 31 |
RewriteRule "^files/(.*)$" "http://%{ENV:HAXELIB_CDN}/files/$1" [P] |
| 32 |
|
| 33 |
# Rewrite rules to send Haxe remoting calls on "/" to "haxelib1/". If it matches, that's [L], the last rule - go their immediately. |
| 34 |
|
| 35 |
RewriteBase / |
| 36 |
RewriteCond %{HTTP:X-Haxe-Remoting}: 1 |
| 37 |
RewriteRule ^index\.n$ legacy/index.n [L] |
| 38 |
|
| 39 |
# Enable rewrite for the new site's pages, only if the file or dir doesn't exist |
| 40 |
|
| 41 |
RewriteBase / |
| 42 |
RewriteCond %{REQUEST_FILENAME} !-f |
| 43 |
RewriteCond %{REQUEST_FILENAME} !-d |
| 44 |
RewriteRule ^(.*)$ index.n/$1 [L] |
| 45 |
|
| 46 |
# Get our stuff gzipped |
| 47 |
|
| 48 |
SetOutputFilter DEFLATE |
| 49 |
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript |