开发者

Zend AutoLoader not functioning properly under Shared hosting

I recently lauched a zend framework project on a shared hosting. With much struggle, I got the first index page working, but pass it all the autoloadable classes like models, forms, mappers are not found.

Here is the version of .htaccess i am using outside the public directory on the root folder.

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/ind开发者_如何学运维ex.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

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

A bit surprising fact is that same mappers and forms are recognised in the front page, or the baseURL, but surpass it, nothing is working.

What am i doing wrong or missing?


I think if you copy index.php and .htaccess from the Zend Framework "public" folder and put it in your public_html or equivalent directory. If your Zend Framework application directory is in the same directory as public_html then the default .htaccess file and index.php file should work.

/home/yoursite
--application/
---- controllers
---- forms/
---- models/
---- views/
-- library/
-- public_html/ (public)
---- .htaccess
---- index.php


Use this instead

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

Basic idea is if a file exist for requested url on server then send it to the client browser otherwise forward the request to ZF application to deal with it.

To make your public dir accessible under root domain edit Apache httpd.conf file instead . Map your virtual host to public dir directly .


Can you try the solution that i looked for and apply. It's worked for me. http://blog.motane.lu/2009/11/24/zend-framework-and-web-hosting-services/

You fill all content of /public_html/.htaccess (not /public_html/public/.htaccess) by

RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜