Skip to content

Commit

Permalink
Fixed redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
arrubiu committed Nov 16, 2017
1 parent f8df7c3 commit aae3a54
Showing 1 changed file with 1 addition and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function on404(GetResponseForExceptionEvent $event) {
$current_path = $event->getRequest()->getRequestUri();
$this->args = explode('/', $current_path);
$this->main_arg = $this->args[1];
$this->status = '301'; \Drupal::logger('si8_utils')->notice('entro nella classe');
$this->status = '301';
$query = \Drupal::request()->query;

// Check notizie ed eventi
Expand All @@ -41,152 +41,130 @@ public function on404(GetResponseForExceptionEvent $event) {
}

if (isset($this->args[2])) {

if (substr($this->args[2], 0, 13) == 'aggiornamento') {
$new_url = '/' . $this->args[1] . '/news/' . $this->args[2];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('46');
return $this->event;
}

if ($this->args[2] == 'albero-di-navigazione') {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('53');
return $this->event;
}

if ($this->args[2] == 'approfondimenti') {
$new_url = '/' . $this->args[1] . '/approfondimenti';
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('60');
return $this->event;
}

if ($this->args[2] == 'area-riservata') {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('67');
return $this->event;
}

if ($this->args[2] == 'articoli') {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('74');
return $this->event;
}

if ($this->args[2] == 'calendar-node-field-data-evento') {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('81');
return $this->event;
}

if (substr($this->args[2], 0, 7) == 'eventi?' && !isset($this->args[3])) {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('88');
return $this->event;
}

if ($this->args[2] == 'file') {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('94');
return $this->event;
}

if ($this->args[2] == 'glossario' && isset($this->args[3])) {
$new_url = '/' . $this->args[1] . '/glossario';
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('102');
return $this->event;
}

if ($this->args[2] == 'news' && isset($this->args[3])) {
$new_url = '/' . $this->args[1] . '/news';
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('109');
return $this->event;
}

if ($this->args[2] == 'node' && isset($this->args[3])) {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('116');
return $this->event;
}

if ($this->args[2] == 'print' && isset($this->args[3])) {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('123');
return $this->event;
}

if ($this->args[2] == 'printpdf' && isset($this->args[3])) {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('130');
return $this->event;
}

if (substr($this->args[2], 0, 18) == 'risultati_ricerca?') {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('137');
return $this->event;
}

if ($this->args[2] == 'servizi' && isset($this->args[3]) && $this->args[3] == 'finanzia-impresa') {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('144');
return $this->event;
}

if ($this->args[2] == 'servizi' && isset($this->args[3]) && $this->args[3] == 'investire-sardegna') {
$new_url = '/' . $this->args[1] . '/investire-sardegna';
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('151');
return $this->event;
}

if ($this->args[2] == 'strutture-territoriali' && isset($this->args[3])) {
$new_url = '/' . $this->args[1] . '/sportello-unico';
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('158');
return $this->event;
}


if ($this->args[2] == 'suap' && isset($this->args[3])) {
$new_url = '/' . $this->args[1] . '/sportello-unico';
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('166');
return $this->event;
}

if ($this->args[2] == 'tabelle' && isset($this->args[3])) {
$new_url = '/' . $this->args[1] . '/sportello-unico';
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('173');
return $this->event;
}

if ($this->args[2] == 'tags' && isset($this->args[3])) {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('180');
return $this->event;
}

if ($this->args[2] == 'taxonomy' && isset($this->args[3])) {
$new_url = '/' . $this->args[1];
$this->setRedirect($event, $new_url);
\Drupal::logger('si8_utils')->notice('187');
return $this->event;
}
}
Expand Down

0 comments on commit aae3a54

Please sign in to comment.