code: public function findAllRedirects ($currentSiteOnly = false)
  	{
  		if ($currentSiteOnly)
  			return RedirectRecord::find()->where(
  				'[[siteId]] IS NULL OR [[siteId]] = ' .
  				\Craft::$app->sites->currentSite->id
  			)->orderBy('siteId asc')->all();
  
  		return array_reduce(
  			RedirectRecord::find()->all(),
  			function ($a, RedirectRecord $record) {
  				$a[$record->siteId ?? 'null'][] = $record;
  				return $a;
  			},
  			array_reduce(
  				\Craft::$app->sites->allSiteIds,
  				function ($a, $id) {
  					$a[$id] = [];
  					return $a;
  				},
  				[]
  			)
  		);
  	}
docs: Returns all the redirects
  
  @param bool $currentSiteOnly
  
  @return array