It seems to me as a lot of overhead. I created a structure like:
/application/ /library/ /index.php / .htaccess /(all other files that would otherwise go in /public/) The .htaccess file disables access to /application/ and /library/ and redirects nonexistent URLs to index.php. Paths in index.php are modified to find /application/ and /library/. I could see a justification for your solution, when you want your application to be able to be installed the recommended way. Kind regards, Vincent de Lau mailto:[email protected] http://vincent.delau.nl From: Luiz A Brandao Jr [mailto:[email protected]] Sent: Tuesday, January 06, 2009 7:08 PM To: Pádraic Brady Cc: Alan Wagstaff; Zend Framework General Subject: Re: [fw-general] Project Structure / Public directory My problem is like you previously described. When using plesk one usually can't access files outside the httpdocs folder due to open_basedir configuration. So I have to put all application files in the web directory. So if I have a guestbook application I would put all files inside httpdocs/guestbook and follow the standard directory structure from there, what means that I will have httpdocs/guestbook/public, httpdocs/guestbook/application etc Then with the following .htaccess I would check if a request match a file in the public folder and allow it, otherwise rewrite to index.php Just to exemplify: if a request like http://mysite/guestbook/images/someimage.jpg match a image in httpdocs/guestbook/public/images/someimage.jpg it will rewrite to that image, if not, it will rewrite to index.php The only difference is that that index.php stays outside of the public foder. But I'm sure this can be changed with additional rewrite rules. I think this way we can follow the default folder structure even inside the web root folder and organize multiple applications into their own folders. What do you think of this aproach? Do you think the .htaccess can be improved? RewriteEngine On RewriteBase /myapp RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteCond %{DOCUMENT_ROOT}/myapp/public/$1 -s [OR] RewriteCond %{DOCUMENT_ROOT}/myapp/public/$1 -l [OR] RewriteCond %{DOCUMENT_ROOT}/myapp/public/$1 -d RewriteRule ^(.*)$ public/$1 [NC,L] RewriteRule ^.*$ index.php [NC,L] On Mon, Jan 5, 2009 at 9:43 PM, Pádraic Brady <[email protected]> wrote: One possible solution is setting a .htaccess file for the other root directories setting the "deny from all" directive to forbid access. Pádraic Brady http://blog.astrumfutura.com http://www.survivethedeepend.com OpenID Europe Foundation <http://www.openideurope.eu/> Irish Representative _____ From: Alan Wagstaff <[email protected]> To: Zend Framework General <[email protected]> Sent: Monday, January 5, 2009 10:44:37 PM Subject: [fw-general] Project Structure / Public directory Hi all, In most of the ZF tutorials I have read (ZF Quickstart, Rob's one, ZF Book), they all recommend setting your Apache's webroot to your /zfapp/public/ directory for security reasons. I can understand the logic, putting the application / library directory outside of the webroot is a good thing but I'm thinking ahead to distribution and struggling to understand. Take for example, vBulletin - a popular forum software. When you download vBulletin, you unzip it, grab the /forum directory and dump it in your webroot. Then visit http://www.example.com/forum and there's your forum. You could also put it in /community/forum and it would work just as well. I don't really understand how I could do that with ZF using the recommend project structure. How would I go about setting up my project structure / .htaccess so the end user could put my app in whatever sub-folder they wanted on their website, and not just in the webroot? Thanks in advance :) Alan.
