I am getting trouble establishing my httpd.conf or .htaccess files to identify multiple zend framework sites on a single server.

For development, I've only one server and I am attempting to setup the websites in order to access them like localhost/app1, localhost/app2, etc.

So at this time, after i visit localhost/app1 it will effectively redirect to localhost/app1/public/index.php, however, if Time passes to localhost/app1/index/index I recieve a 404.

Here's my vhosts file:

<VirtualHost *:80>

    ServerAdmin website owner@localhost

    DocumentRoot "/var/world wide web"

    <Directory />

        Options FollowSymLinks

        AllowOverride None

    </Directory>

    <Directory "/var/world wide web/app1/public">

        Options Indexes FollowSymLinks MultiViews

        AllowOverride All

        Order allow,deny

        allow all

    </Directory>

    ErrorLog logs/error.log

    CustomLog logs/access.log common

</VirtualHost>

here is my .htaccess file in the /var/world wide web/app1 directory:

RewriteEngine On

RewriteCond % -s [OR]

RewriteCond % -l [OR]

RewriteCond % -d

RewriteRule ^.*$ /app1/public/index.php [NC,R,L]

Basically alter the DocumentRoot line within the vhosts file to DocumentRoot "/var/world wide web/app1/public" then app1 works properly, however i are only able to access that certain... at http://localhost. Is possible? What I wish to happen is that if /var/world wide web may be the document root, then basically visit localhost/app1, individuals demands have to redirect to localhost/app1/public/index.php and when Time passes to localhost/app2 individuals demands have to redirect to localhost/app2/public/index.php.

I really hope I described this clearly, any assistance is appreciated.

Ultimately
I loved Phil's solution best because I did not wish to have to alter my local hosts file and employ the ServerName directive. It might be fine inside a production atmosphere should you own another domain reputation for each application, although not for development.

Additionally to that particular, I had been getting a 403 forbidden problem when utilizing another directory for serving up content. When I mentioned, the perms appeared correct the issue was with SE_Linux, and also the security context from the files not set to httpd_sys_content_t. I am posting that solution which i found here, because it deals particularly using the problem. Thanks.

Some tips about what I'd do...

  1. Install your programs somewhere arbitrary but outdoors the document root, eg /home/sudol/applications/app1 and /home/sudol/applications/app2. Make certain your Apache user can traverse this path and browse the files.

  2. Alias the public sites inside your <VirtualHost> section

    Alias /app1 /home/sudol/applications/app1/public
    
    Alias /app2 /home/sudol/applications/app2/public
    
    
  3. Setup your access and rewrite rules within the appropriate <Directory> sections (one for every application), eg

    <Directory "/home/sudol/applications/app1/public">
    
        Options Indexes FollowSymLinks MultiViews
    
        AllowOverride All
    
        Order allow,deny
    
        allow all
    
        RewriteEngine On
    
        RewriteBase /app1
    
        RewriteCond % -s [OR]
    
        RewriteCond % -l [OR]
    
        RewriteCond % -d
    
        RewriteRule ^.*$ - [NC,L]
    
        RewriteRule ^.*$ index.php [NC,L]
    
    </Directory>
    
    
  4. Remove the .htaccess files because you will no more need them

Addendum

Make certain you place unique session names inside your application config. You may also set specific cookie pathways but this really is optional, eg

 app1/application/configs/application.ini

assets.session.title = "app1"

assets.session.cookie_path = "/app1/"

 app2/application/configs/application.ini

assets.session.title = "app2"

assets.session.cookie_path = "/app2/"

Its easier to use subdomain i.e app1.localhost then localhost/app1 . Because the way snacks are saved (including session cookie) can provide you with problem latter . They'll mismatch or may even overlap .

This is a good tutorial to create the most well-liked way

http://world wide web.dennisplucinik.com/blog/2007/08/16/setting-up-multiple-virtual-hosts-in-wamp/