-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #418 from keymanapp/chore/b17s1-merge-staging-into…
…-master chore: b17s1 merge staging into master
- Loading branch information
Showing
85 changed files
with
2,095 additions
and
1,721 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
Dockerfile text eol=lf | ||
*.sh eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
# This file is used when running with Apache. Adapted from web.config. | ||
# NOTE: this is not very well tested... | ||
|
||
# We turn off automatic addition of slashes for directories because it | ||
# interferes with the file extension removal for .php files. At the bottom of | ||
# this file, we have a redirect rule to mimic the same behaviour, _after_ the | ||
# relevant rewrite rules have been applied | ||
DirectorySlash off | ||
|
||
RewriteEngine on | ||
RewriteBase / | ||
|
||
# Add mime type for apple-app-site-association | ||
AddType application/json apple-app-site-association | ||
|
||
# Custom error messages | ||
# ErrorDocument 404 /_includes/errors/404.php | ||
|
||
# apple-app-site-association | ||
RewriteRule "^.well-known/apple-app-site-association$" "/.well-known/apple-app-site-association.json" [L] | ||
|
||
# macosx and macos to mac (ignore case) | ||
RedirectMatch 301 "^(?i)/(macosx|macos)\b(.*)$" "/mac$2" | ||
|
||
# Redirect deprecated Google Plus link | ||
RedirectMatch 301 "^(?i)/plus.*" "/" | ||
|
||
# /donate -> donate.keyman.com | ||
RedirectMatch 301 "^(?i)/donate(\/.*)?" "https://donate.keyman.com" | ||
|
||
# /privacy -> SIL Privacy policy | ||
RedirectMatch 301 "^(?i)/privacy(\/.*)?" "https://software.sil.org/language-software-privacy-policy/" | ||
|
||
# desktop to windows | ||
RedirectMatch 301 "^(?i)/desktop(\/.*)?" "/windows$1" | ||
|
||
# releases-tier/download | ||
# note: the tier is currently ignored | ||
RewriteRule "^downloads/releases/(alpha|beta|stable)/(.+)$" "/downloads/releases/_version_downloads.php?tier=$1&version=$2" [R,END] | ||
|
||
# releases-download | ||
RewriteRule "^downloads/releases/(?!_version_downloads\b)(.+)$" "/downloads/releases/_version_downloads.php?version=$1" [R,END] | ||
|
||
# index | ||
RewriteRule "^downloads/releases(\/)?$" "/downloads" [R,END] | ||
|
||
# Ready | ||
RewriteRule "^_control/ready$" "_control/ready.php" [END] | ||
|
||
# | ||
# Keyboard landing pages (TODO) | ||
# | ||
|
||
# Cleanup various URLS with permanent redirects | ||
|
||
# /keyboards/{install|download|share}/{id}/ to /keyboards/x/id | ||
# Remove final / | ||
RewriteRule "^keyboards/(install|download|share)/([^/]+)/$" "/keyboards/$1/$2" [R=301,END,QSA] | ||
|
||
# /keyboards/{id}/ to /keyboards/id | ||
# Remove final / | ||
RewriteRule "^keyboards/([^/]+)/$" "/keyboards/$1" [R=301,END,QSA] | ||
|
||
# /keyboards/ to /keyboards (Handled by other redirect) | ||
# Remove final / | ||
|
||
# Old share url /keyboards/{id}/share[/] to /keyboards/share/id | ||
RewriteRule "^keyboards/(.*)/share(/?)$" "/keyboards/share/$1" [R=301] | ||
|
||
# /keyboard/{content} to /keyboards/... | ||
RewriteRule "^keyboard(/.*)$" "/keyboards$1" [R,END] | ||
|
||
# | ||
# Install | Download | Share | bare | .json --> | ||
# | ||
|
||
# /keyboards/install/[id] to /keyboards/install.php | ||
RewriteRule "^keyboards/install/([^/]+)$" "/keyboards/install.php?id=$1" [END,QSA] | ||
|
||
# /keyboards/download/[id] to /keyboards/keyboard.php | ||
# This formerly redirected to a download, but we no longer need it; keep it for | ||
# legacy links | ||
RewriteRule "^keyboards/download/([^/]+)$" "/keyboards/keyboard.php?id=$1" [END,QSA] | ||
|
||
# /keyboards/share/[id] to /keyboards/share.php | ||
# if the keyboard exists in the repo, then share.php will redirect to /keyboards/<id> | ||
RewriteRule "^keyboards/share/([^/]+)$" "/keyboards/share.php?id=$1" [END] | ||
|
||
# /keyboards/{id}.json to /keyboards/keyboard.json.php | ||
RewriteRule "^keyboards/(?!keyboard.json)(.*)\.json$" "/keyboards/keyboard.json.php?id=$1" [END] | ||
|
||
# /keyboards/{id} to /keyboards/keyboard.php | ||
RewriteRule "^keyboards/(?!index\.php|install|keyboard|session|share)([^/]+)$" "/keyboards/keyboard.php?id=$1" [END,QSA] | ||
|
||
|
||
# | ||
# Search | ||
# | ||
|
||
# /keyboards?q=... to /keyboards/index.php | ||
# RewriteRule "^keyboards$" "/keyboards/index.php" [L] | ||
|
||
# /keyboards/languages to /keyboards/index.php | ||
RewriteRule "^keyboards/languages/(.*)" "/keyboards/index.php?q=l:id:$1" [END] | ||
|
||
# /keyboards/download to /keyboards/download.php | ||
RewriteRule "^keyboards/download(.php)?" "/keyboards/download.php" [END,QSA] | ||
|
||
# /keyboards/legacy to /keyboards/keyboard.php | ||
RewriteRule "^keyboards/legacy/(.*)" "/keyboards/keyboard.php?legacy=$1" [END] | ||
|
||
# /keyboards/countries to /keyboards/index.php | ||
RewriteRule "^keyboards/countries/(.*)" "/keyboards/index.php?q=c:id:$1" [END] | ||
|
||
# Synonym paths | ||
|
||
# 10.0 to 15.0 | ||
# /1X.0 to /1X landing page | ||
RedirectMatch "^/1([0-5])(\.0)\/?" "/1$1/" | ||
|
||
# ios | ||
RedirectMatch "^/(?!iphone-and-ipad)(ios|iphone|ipad)(\/.*)?" "/iphone-and-ipad$2" | ||
|
||
# Connect With Art landing page | ||
RedirectMatch "/connectwithart(\/|$)" "https://sites.google.com/sil.org/connectwithart/home" | ||
|
||
# per-language landing pages | ||
RedirectMatch "^/albanian(/?)$" "/keyboards/basic_kbdal" | ||
RedirectMatch "^/ancient-egyptian(/?)$" "/keyboards/hieroglyphic" | ||
RedirectMatch "^/ancient-hebrew(/?)$" "/keyboards/galaxie_greek_hebrew_mnemonic" | ||
RedirectMatch "^/arabic(/?)$" "/keyboards/basic_kbda1" | ||
RedirectMatch "^/assamese(/?)$" "/keyboards/isis_bangla" | ||
RedirectMatch "^/basic_kbdsn1(/?)$" "/keyboards/basic_kbdsn1" | ||
RedirectMatch "^/bengali(/?)$" "/keyboards/basic_kbdinbe2" | ||
RedirectMatch "^/cherokee(/?)$" "/keyboards/cherokee6" | ||
RedirectMatch "^/cheyenne(/?)$" "/keyboards/sil_cheyenne" | ||
RedirectMatch "^/dinka(/?)$" "/keyboards/el_dinka" | ||
RedirectMatch "^/dutch(/?)$" "/keyboards/basic_kbdne" | ||
RedirectMatch "^/farsi(/?)$" "/keyboards/farsi_unicode" | ||
RedirectMatch "^/hebrew(/?)$" "/keyboards/basic_kbdheb" | ||
RedirectMatch "^/hindi(/?)$" "/keyboards/basic_kbdindev" | ||
RedirectMatch "^/igbo(/?)$" "/keyboards/sil_nigeria_dot" | ||
RedirectMatch "^/khmer(/?)$" "/keyboards/khmer_angkor" | ||
RedirectMatch "^/lao(/?)$" "/keyboards/basic_kbdlao" | ||
RedirectMatch "^/malayalam(/?)$" "/keyboards/basic_kbdinmal" | ||
RedirectMatch "^/maltese(/?)$" "/keyboards/maltese" | ||
RedirectMatch "^/marathi(/?)$" "/keyboards/basic_kbdinmar" | ||
RedirectMatch "^/mongolian(/?)$" "/keyboards/basic_kbdmon" | ||
RedirectMatch "^/nepali(/?)$" "/keyboards/basic_kbdnepr" | ||
RedirectMatch "^/oriya(/?)$" "/keyboards/basic_kbdinori" | ||
RedirectMatch "^/rawang(/?)$" "/keyboards/rawang" | ||
RedirectMatch "^/russian(/?)$" "/keyboards/basic_kbdru" | ||
RedirectMatch "^/serbian(/?)$" "/keyboards/basic_kbdycc" | ||
RedirectMatch "^/sindhi(/?)$" "/keyboards/mbsindhi" | ||
RedirectMatch "^/thai(/?)$" "/keyboards/thai-uni" | ||
RedirectMatch "^/yiddish(/?)$" "/keyboards/yiddish_pasekh" | ||
RedirectMatch "^/yoruba(/?)$" "/keyboards/sil_yoruba8" | ||
|
||
RedirectMatch "^/ancient-greek(/?)$" "/keyboards/h/greek" | ||
RedirectMatch "^/(french|german|italian|spanish|swedish)(/?)$" "/keyboards/h/eurolatin" | ||
|
||
# dedicated-keyboard-landing pages | ||
RedirectMatch 301 "^/(amharic|burmese|cameroon|ethiopic|eurolatin|greek|ipa|sinhala|tamil|tibetan|tigrigna|urdu)(/.*)?$" "/keyboards/h/$1$2" | ||
|
||
# | ||
# PHP and Markdown rewriting | ||
# | ||
|
||
# Remove index or index.php and redirect (and stop processing) | ||
RewriteCond "$1" -d | ||
RewriteRule "^((.+)/)?index(\.php)?$" "$1" [R,L] | ||
|
||
# Remove .php extension and redirect | ||
RewriteCond "$1.php" -f | ||
RewriteCond "$1" !-d | ||
RewriteRule "^(.+)\.php$" "$1" [R,L] | ||
|
||
# Redirect folder without / to include / | ||
RewriteCond "{DOCUMENT_ROOT}/$1" -d | ||
RewriteCond "{DOCUMENT_ROOT}/$1.php" !-f | ||
RewriteCond "{DOCUMENT_ROOT}/$1.md" !-f | ||
RewriteRule "^(.+[^/])$" "$1/" [R,END] | ||
|
||
# | ||
# PHP rewriting | ||
# | ||
|
||
# TODO: mdhost currently in a different path than help.keyman | ||
|
||
# Rewrite file to file.md | ||
RewriteCond "%{DOCUMENT_ROOT}/$1.md" -f | ||
RewriteRule "^(.+)$" "/_includes/includes/md/mdhost.php?file=$1.md" [END] | ||
|
||
# Rewrite file to file.php | ||
RewriteCond "%{DOCUMENT_ROOT}/$1.php" -f | ||
RewriteCond "%{DOCUMENT_ROOT}/$1.md" !-f | ||
RewriteRule "^(.+)$" "$1.php" [END] | ||
|
||
# Rewrite folder/ to folder/index.md | ||
RewriteCond "%{DOCUMENT_ROOT}/$1/index.md" -f | ||
RewriteRule "^(.+)/$" "/_includes/includes/md/mdhost.php?file=$1/index.md" [END] | ||
|
||
# Rewrite folder/ to folder/index.php | ||
RewriteCond "%{DOCUMENT_ROOT}/$1/index.php" -f | ||
RewriteCond "%{DOCUMENT_ROOT}/$1/index.md" !-f | ||
RewriteRule "^(.+)/$" "$1/index.php" [END] | ||
|
||
# Finally, append the terminating slash for folders, given it is no longer | ||
# done automatically because we put DirectorySlash off | ||
RewriteCond %{REQUEST_FILENAME} -d | ||
RewriteRule "^(.*)([^/])$" "$1$2/" [R] |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.