niksmac
niksmac

Reputation: 2782

Zend instance in a subfolder of another Zend

Hi i have a Zend installation in main domain. Now i want to make a subfolder and run Zend for some testing purposes. I have copied all files from main site to subfolder named www2. But when i call the subfolder like domain.com/www2 i think the main Zend instance get invoked and produces a Message: Invalid controller specified (www2) error?

my .htaccess of main Zend is

SetEnv APPLICATION_ENV development
RewriteEngine on
RewriteCond %{REQUEST_URI} "/www2/"
RewriteRule (.*) $1 [L]

and Subfolder is like

SetEnv APPLICATION_ENV development
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

What i am doing Wrong. I have full access to server.

Upvotes: 0

Views: 175

Answers (2)

BattleBit
BattleBit

Reputation: 754

in subfolder Zend in file application/Bootstrap.php add LIKE this:

protected function _initRoutes()
{
        $this->bootstrap('frontcontroller');
        /**
         * @var Zend_Controller_Front $front
         */
        $front = $this->getResource('frontcontroller');
        /**
         * @var Zend_Controller_Router_Rewrite $router
         */
        $router = $front->getRouter();
        $router->addRoute('www2',
            new Zend_Controller_Router_Route(
                'www2/:controller/:action',
                array('controller' => 'index',
                      'action' => 'index'))
        );
}

But may be you need another route...

UPD1: first .htaccess like this:

RewriteEngine On

RewriteCond %{REQUEST_URI}  ^/www2*
RewriteRule ^.*$ www2/index.php [NC,L]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Upvotes: 2

David Weinraub
David Weinraub

Reputation: 14184

You could create a subdomain www2.domain.com pointing the www2/public directory and restore all .htaccess files to their normal single-site state.

This way, the www2 copy is completely standalone app with the same url and file structure as the original www site.

Upvotes: 0

Related Questions