Running Zend Framework Applications in AppFog

AppFog is quite a popular polyglot PaaS (Platform as a Service) provider and it comes with a generous free plan for the developers. With the free plan, you can host as many apps as you want with 2GB ram limit, database from 100 to 1GB limit and so on. I’ve been using AppFog since the beginning and I must say that I really love their service.

Recently, I was looking for a solution on how to host a Zend Framework based application in AppFog. The main problem was that the url must point to the /public folder inside the app and  from there it is initialized.  After searching for some time, I found the clue in AppFog’s doumentation which is you’ll have to redirect all the traffic from the parent domain to the /public/index.php file using the URL rewrite rules. Here is the content of the .htaccess file that you will have to keep in the application root directory.

[sourcecode lang=”shell”]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.tld$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.yourdomain.tld$
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
[/sourcecode]

This is mainly it. Once you have placed the .htaccess file in the root folder of your application, it will work flawlessly.

Shameless Plug

We develop beautiful Admin Panel templates for the web application developers. Our recent product is “Bolt” which is responsive and built on top of Twitter’s bootstrap. Give it a try and let us know how do you like it.

Bolt Responsive Admin Panel Template for Developers
Bolt Responsive Admin Panel Template for Developers