1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
my $url01 = admin.domain.tld; my $url02 = admin.domain2.tld; if($vhost == $url01){ { $default_page = default_page; } elsif($vhost == $url02) { $default_page = default_page2; } else { $default_page = default_page; }
1 2 3 4 5 6 7
my $domain0 = "$ENV{'HTTP_HOST'}"; if $domain0 == "admin.domain.tld" { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page"; } if $domain0 == "admin.domain2.tld" { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page2"; }
1 2 3 4 5 6 7
my $domain0 = $ENV{'HTTP_HOST'}; if $domain0 eq "admin.domain.tld" { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page"; } if $domain0 eq "admin.domain2.tld" { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page2"; }
1 2 3 4 5 6 7
my ($index_tpl, $err_cfg_dir) = (undef, undef); my $vhost = $main::cfg{'BASE_SERVER_VHOST'}; my $prefix = $main::cfg{'BASE_SERVER_VHOST_PREFIX'}; $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page"; $rs, $index_tpl) = get_tpl($err_cfg_dir, 'index.html'); return $rs if ($rs != 0);
1 2 3 4 5 6 7 8 9 10 11 12 13
my ($index_tpl, $err_cfg_dir) = (undef, undef); my $vhost = $main::cfg{'BASE_SERVER_VHOST'}; my $prefix = $main::cfg{'BASE_SERVER_VHOST_PREFIX'}; my $domain0 = $ENV{'HTTP_HOST'}; if $domain0 eq "admin.domain.tld" { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page"; } if $domain0 eq "admin.domain2.tld" { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page2"; } return $rs if ($rs != 0);
2011-04-10T17:30:25 montymomentan funktioniert es so nicht:
Code (perl): (dl )1 2 3 4 5 6 7 8... my $domain0 = $ENV{'HTTP_HOST'}; if $domain0 eq "admin.domain.tld" { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page"; } if $domain0 eq "admin.domain2.tld" { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/default_page2"; }
1 2 3 4 5 6 7
my $domain0 = $ENV{'HTTP_HOST'}; if ($domain0 eq 'admin.domain.tld') { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/domain_default_page"; } if ($domain0 eq 'admin.domain2.tld') { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/domain_default_page2"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
my $domain0 = $ENV{'HTTP_HOST'}; ## Kontrolle; kontrolliere error_log des Webservers warn "Domain0: >$domain0< "; if ( !defined $domain0 ) { # Fehlerbehandlung oder Defaults setzen, wenn keine Domain definiert } elsif ($domain0 eq 'admin.domain.tld') { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/domain_default_page"; } elsif ($domain0 eq 'admin.domain2.tld') { $err_cfg_dir = "$main::cfg{'GUI_ROOT_DIR'}/domain_default_page2"; } else { # unbekannte Domain, tu was entsprechendes! }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
sub determine_err_cfg_dir { # achtung! eigenständige Variable my $err_cfg_dir; if ( "bedingung" ) { $err_cfg_dir = '1. bedingung'; } elsif ( "bedinung2" ) { $err_cfg_dir = '2. bedingung'; } # jetzt sollte $err_cfg_dir gesetzt sein, oder vielleicht nicht? } ## Main block ... { my $err_cfg_dir = ''; # to be defined # in determine_err_cfg_dir wird eine eigene, andere $err_cfg_dir gesetzt, # welche nichts mit der obigen "to be defined" zu tun hat determine_err_cfg_dir(); # kontrolle print $err_cfg_dir, "\n"; }