Search code examples
apachecakephpvirtual-hosts

Cakephp redirect not working on virtual host


I would like to tell you about the problem I´m having now. The thing is that I moved my cakephp project from the test enviroment to the production enviroment, the production server handles some virtual servers. So, i placed my project in D:\xampp\htdocs. And added the following lines in my httpd-vhosts.conf:

<VirtualHost *:80>
    ServerAdmin admin@myhost.com.mx
    DocumentRoot "D:/xampp/htdocs/enterprise"
    ServerName enterprise.ent.com
    ErrorLog "logs/enterprise.ent.com.log"
    CustomLog "logs/enterprise.ent.com.log" combined
</VirtualHost>

The problem comes when I log in, everything works fine, until I make a redirect with the line:

$this->redirect("/Main");

This redirect takes me again to the log in page, so this tells me the redirect did not work. Does anybody know about this?, could you give some help?

I´m using apache 2.2 over windows server. Best regards and thanks in advance.


Solution

  • I´m happy to tell you that I already solved the problem, The thing was that I had configured the session with the following:

        Configure::write('Session', array(
        'defaults' => 'php',
        'ini' => array(
            'session.cookie_path' => '/enterprise',
        ),
        'cookie' => 'enterprise',
        'cookieTimeout' => 0,   
           'checkAgent'  => false  
    ));
    

    I don´t really know why, but after removing the 'ini' section It Works like a charm :O, so the code goes like follows:

        Configure::write('Session', array(
        'defaults' => 'php',
        'cookie' => 'enterprise',
        'cookieTimeout' => 0,   
           'checkAgent'  => false  
    ));
    

    I hope this helps someone in the future. Thank you very much for your answers, I really appreciate your help.