Roshan Book

My Tech Notebook

Tag Archives: zend on shared hosting

Deploying Zend Framework based website on shared hosting

I was really exhausted searching the way to do this. As on shared hosting  you don’t have access to httpd.config file. There is this website which has given a very simple way to do this. Below is content from his website.

Here’s a short tip for those who need to publish a Zend Framework project on a shared hosting. The typical project structure for a Zend Framework project is something like this:


The public directory contains all the files that should be directly accessible via the web server, so you must set your web server’s document root to this directory.
The problem is, in most shared hosting setups you can’t change the document root, and the root directory of your account (i.e. the uppermost level you see when you connect via FTP) isthe public document root.

To solve this problem without changing the above directory structure, you can remove the.htaccess file from the public directory, and place this one in the root directory instead:

RewriteEngine On
RewriteRule ^.htaccess$ - [F]
RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]

This is an effective way to “move” the document root up one level to the public directory.
%d bloggers like this: