Question

I'm trying to make a simple Zend Webapp running on a shared host. The root folder after logging on FTP server is a folder named 'www'. So the structure is:

/www
   /tasklist
        /application
        /library
        /public
        /.htaccess

Hosting provider demands to have all paths in .htacccess file absolute. Considering this, the path to main index.php of my Zend app is:

http://aportsupport.cz/tasklist/public/index.php

Which is also a link at which I am able to access my app but with other paths to certain files (css, js etc.) do not work. When I try to access my app with:

http://aportsupport.cz/tasklist/

I only get 404 or 403 error depending on various setups of .htaccess I've already tried. I have no access to error log, nor any server configs. Default controller is 'index', action 'index', module 'default'.

Was it helpful?

Solution 2

Thank you for your response, however, I've finally managed to make it work myself. For all those who might have similar issues this solution worked for me:

I created a subdomain 'tasklist.aportsupport.cz' which has its own root folder on my shared host. In this folder I put all Zend folders with their default structure. Also I created index.php file in which I wrote this:

<?php include 'public/index.php';

This index.php is located in root of tasklist.aportsupport.cz with default Zend Framewrok .htaccess in which I added this line:

RewriteBase /

Also all CSS, JS, imgs etc. files are located in that root folder. Everything works just fine!

OTHER TIPS

In a Zend application, the .htaccess should be in your public folder, so your folder tree will look like this:

/www
    /tasklist
        /application
        /library
        /public
            /.htaccess

Your .htaccess can be kept simple for most Zend applications. Try this text out for .htaccess:

Options +FollowSymlinks

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

What this breaks down to is that no matter what url is requested from this root directory, it will try to fetch the file /www/tasklist/public/index.php, which will bootstrap the Zend application.

Remember that if your hosting provider does not support Zend Framework, it may not work out at all. Hosting providers like http://www.phpcloud.com/ do allow Zend-based applications but you have to specify it on container creation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top