Roshan Book

My Tech Notebook

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.

4 responses to “Deploying Zend Framework based website on shared hosting

  1. autoblogging August 11, 2011 at 6:23 am

    Great spending some time to talk about this, I find myself powerfully relating to this and additionally absolutely love discovering much more the content. As long as chance, simply because you acquire mastery, you thought processes replacing your webpage with the help of extra help and advice? This is used by me.

  2. Hermes Kelly September 16, 2011 at 5:22 pm

    Yuor web blog never prevents to stun me personally, it is quite well crafted and arranged,

  3. Monster Beats Solo September 20, 2011 at 12:22 pm

    Relatively nice post. I just stumbled upon ones weblog along with planned to declare that I have truly appreciated looking your blog site blog posts. No matter the reason I am registering to your current feast i we do hope you create again eventually!

  4. Dena November 2, 2012 at 11:32 am

    Oh my goodness! Awesome article dude! Thank you so much, However I
    am having problems with your RSS. I don’t know why I can’t subscribe to it.
    Is there anybody else getting identical RSS problems?
    Anyone that knows the solution can you kindly respond? Thanx!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: