Add yaml redirect instead of hardcoding array

This commit is contained in:
Maxime St-Pierre 2018-05-11 03:01:19 -04:00 committed by Jeremy Kauffman
parent 3caa097222
commit 3e98e6871c
3 changed files with 64 additions and 33 deletions

View file

@ -133,40 +133,11 @@ class Controller
$router->post('/set-culture', 'i18nActions::setCulture');
$permanentRedirects = [
'/lbry-osx-latest.dmg' => '/get',
'/lbry-linux-latest.deb' => '/get',
'/dl/lbry_setup.sh' => '/get',
'/art' => '/what',
'/why' => '/learn',
'/feedback' => '/learn',
'/joinus' => '/join-us',
'/faq/when-referral-payouts' => '/faq/referrals',
'/faq/why-care-about-lbry' => '/get',
'/news/meet-the-lbry-founders' => '/team',
'/faq/no-auction-options' => '/faq/naming',
'/join-list' => '/list/subscribe',
'/publish' => '/faq/how-to-publish',
'/faq/quarterly-report-july-2016' => '/credit-reports/2016-Q2',
'/faq/quarterly-report-3q-2016' => '/credit-reports/2016-Q3',
'/faq/Q4-credit-report' => '/credit-reports/2016-Q4',
'/faq/Q1-17-CreditReport' => '/credit-reports/2017-Q1',
'/faq/how-to-report-bugs' => '/faq/support',
'/faq/make-money' => '/faq/earn-income',
];
$tempRedirects = [
'/apple-touch-icon.png' => '/img/fav/apple-touch-icon.png',
'/LBRY-deck.pdf' => 'https://www.dropbox.com/s/0xj4vgucsbi8rtv/lbry-deck.pdf?dl=1',
'/deck.pdf' => 'https://www.dropbox.com/s/0xj4vgucsbi8rtv/lbry-deck.pdf?dl=1',
'/pln.pdf' => 'https://www.dropbox.com/s/uevjrwnyr672clj/lbry-pln.pdf?dl=1',
'/plan.pdf' => 'https://www.dropbox.com/s/uevjrwnyr672clj/lbry-pln.pdf?dl=1',
'/api' => 'https://lbryio.github.io/lbry',
'/api-help' => 'https://lbryio.github.io/lbry',
'/security' => '/faq/security',
'/live' => 'https://www.youtube.com/watch?v=WM60vLOCRps', //'https://www.youtube.com/channel/UCXAcp3dJuPqeUekOacsuyaQ',
];
$permanentRedirectsPath = ROOT_DIR . '/data/redirect/permanent.yaml';
$tempRedirectsPath = ROOT_DIR . '/data/redirect/temporary.yaml';
$permanentRedirects = SpyC::YAMLLoadString(file_get_contents($permanentRedirectsPath));
$tempRedirects = SpyC::YAMLLoadString(file_get_contents($tempRedirectsPath));
foreach ([307 => $tempRedirects, 301 => $permanentRedirects] as $code => $redirects)
{

View file

@ -0,0 +1,50 @@
--
/FLO: /news
/There: /news
/art: /what
/developer-program: /news
/dl/lbry_setup.sh: /get
/faq/Q1-17-CreditReport: /credit-reports/2017-Q1
/faq/Q4-credit-report: /credit-reports/2016-Q4
/faq/make-money: /faq/earn-income
/faq/no-auction-options: /faq/naming
/faq/quarterly-report-3q-2016: /credit-reports/2016-Q3
/faq/quarterly-report-july-2016: /credit-reports/2016-Q2
/faq/when-referral-payouts: /faq/referrals
/faq/why-care-about-lbry: /get
/feedback: /learn
/get.How+to+Create+an+Identity+LBRY+TutorialsFollow: /faq/identity-requirements
/getFree: /news/free-lbry-credits-come-and-get-em
/join-list: /list/subsribe
/joinus: /join-us
/lbry-linux-latest.deb: /get
/lbry-osx-latest.dmg: /get
/navframe?selectedItem=/news: /news
/news/$1.2b-market-cap-we-dont-care: /news/1.2b-market-cap-we-dont-care
/news/author/jeremy/2: /team
/news/author/jimmy-kiselak: /team
/news/author/sam/page/2: /team
/news/author/sam/page/3: /team
/news/author/samuel: /team
/news/boom: /news/boombust
/news/every-major-tech-company-hates-you: /news
/news/get: /get
/news/ios: /ios
/news/lbry-promo-video-raw-footage: /news
/news/meet-the-lbry-founders: /team
/news/page/2: /news
/news/page/5: /news
/news/tag/events: /roadmap
/news/tag/freedom-of-information: /news/crypto-freedom
/news/tag/team: /team
/news/team: /team
/news/what: /what
/news/windows: /news/lbry-windows
/news/www.maidsafe.com: /news
/news/www.porcfest.com: /news/lbry-at-porcfest-first-public-screening-film-via-blockchain
/nothing-here: /news
/publish: /youtube
/what-is-lbry: /faq/what-is-lbry
/youtube/cdSSo: /news
/youtube/sync: /faq/youtube
faq/how-to-report-bugs: /faq/support

View file

@ -0,0 +1,10 @@
---
/LBRY-deck.pdf: "https://www.dropbox.com/s/0xj4vgucsbi8rtv/lbry-deck.pdf?dl=1"
/api: "https://lbryio.github.io/lbry"
/api-help: "https://lbryio.github.io/lbry"
/apple-touch-icon.png: /img/fav/apple-touch-icon.png
/deck.pdf: "https://www.dropbox.com/s/0xj4vgucsbi8rtv/lbry-deck.pdf?dl=1"
/live: "https://www.youtube.com/watch?v=WM60vLOCRps"
/plan.pdf: "https://www.dropbox.com/s/uevjrwnyr672clj/lbry-pln.pdf?dl=1"
/pln.pdf: "https://www.dropbox.com/s/uevjrwnyr672clj/lbry-pln.pdf?dl=1"
/security: /faq/security