1

I'm working with Zend Framework 1, and everything are going all right, except for one thing. My website doesn't load the assets. I know that could be a problem with .htaccess, but i've tried to many thing to fix that without success.

My folder structure is:

|- /
|---application
|---library
|---public
|------assets
|------cgi-bin
|------images
|---resources

My .htaccess file (inside the /public folder):

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

Unfortunately when I access the website, it loads everything, except the files that are located in my /public/assets and /public/images folder. When I try to access the file via URL, the ZEND returns my a "Page not found" error.

Anyone knows how can i fix that?

Thank you!

pedroroccon
  • 81
  • 1
  • 5

1 Answers1

0

I assume that you are using shared hosting and do not have permissions to modify Apache vhost entries. In this case, the problem you are experiencing is pretty common.

One solution that has worked for me is what I call "push-down-and-protect", in which you push down all the ZF content - application, data, library, etc - into its own _zf directory as a sibling of assets, inside your public directory. Then add a DENY ALL to an .htaccess in that _zf directory and tweak paths in your top-level public/index.php entry-point.

Note: Adding that DENY ALL in an .htaccess is CRITICAL since the standard ZF setup has config, creds, and other data that you do not want to be directly accessible via the web. That is admittedly a downside to this approach; if you forget to protect that directory, then you are wide open.

This approach is the basis of this answer and is explained in more detail here.

David Weinraub
  • 14,144
  • 4
  • 42
  • 64