Redirect is working fine on localhost but not in remote host

Hi Guys

The website with few forms is working fine , even with the previous Slim version. Now I am using the latest one and on remote host not no matter what I do the forms submits but chokes on blank page and I hit the back browser I can see the success and error message:

I will just add the controller and view here. I am new to PHP and Slim, coming from Java and Spring and was hoping life would get easier:

//controller contact form



<?php



 define('CONTACT_URL', BASE_URL .'contact');
 
 
 $app->group('/contact', function () use ($app) {
 
  $app->get('/', function () use ($app) {
      
        global $lang;
        
        
        
        $token = token();
        
        $seo_title = 'Contact US ';
        $seo_desc =  'Send us your message ';
        $seo_url = BASE_URL .'';
        
         return  $app->render(THEME_PATH.'contact.php',  array('lang' => $lang,
                    'seo_url'=>"kkkk", 
                    'seo_title'=>"Contact us", 
                    'seo_desc'=>"Yes come at us "));
    });
    
    
    
    // do contact 
     $app->post('/send', function () use ($app) {
         
            global $lang;
            
            
            $data = $app->request->post();
            
            
            $data = escape($data);
            
            //name
            
            $name = $_POST['name'];
            $email = $_POST['email'];
            $message = $_POST['message'];
            $human = intval($_POST['human']);
            $from =   'USJ'; 
            $to =   'support@uksecurityjobs.co.uk'; 
            $subject = 'Message from UK Security Jobs  Contact Form  ';

            if (!$_POST['name']) {
                    $app->flash('danger', $lang->t('contact|contact.name.req'));
                   return  $app->redirect(CONTACT_URL, 301);
            }

            
            //email
            
            if (!$_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
            $app->flash('danger', $lang->t('contact|contact.email.req'));
                   return  $app->redirect(CONTACT_URL, 301);
            }
            
            
            if (!$_POST['message']) {
                    $app->flash('danger', $lang->t('contact|contact.message.req'));
                    return  $app->redirect(CONTACT_URL, 301);
            }
            
           if ($human !== 5) {
                    $app->flash('danger', $lang->t('contact|contact.message.spam'));
                  return  $app->redirect(CONTACT_URL, 301);
           }
           
           
           
             
                $notif = new Notifications();
                
                //  sendMessage($from, $recipient, $message)
            
               if ($notif->sendMessage($from, $to,  $message)) {
               
                    $app->flash('success', $lang->t('contact|contact.message.success'));
                    
                    
                    
                // return    $app->redirect(CONTACT_URL);
                
                  return  $app->redirect(CONTACT_URL, 301);
                 
                 
                 
                    
          
                 } else {
               
               
                    $app->flash('danger', $lang->t('contact|contact.message.error'));
                    
                   return  $app->redirect(CONTACT_URL, 301);
                    
          
          
           }
    
         
         
         
     });
     
     
    
    
 });
 
 
 
 
  
 
 












?>

View:




<?php include 'header.php'; ?>



Contact Us

<?php include 'flash.php'; ?>
Name
Email
Message
2 + 3 = ?
<?php include 'footer.php'; ?>

Thank your for your time

Please read the migration document on how to transition your code from Slim 2 to Slim 3.

http://www.slimframework.com/docs/start/upgrade.html