My problem is like you previously described. When using plesk one usually can't access files outside the httpdocs folder due to open_basedirconfiguration. So I have to put all application files in the web directory. So if I have a guestbook application I would put all files insidehttpdocs/guestbookand 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.jpgmatch a image inhttpdocs/guestbook/public/images/someimage.jpgit 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 Irish Representative<http://www.openideurope.eu/> > > > ------------------------------ > *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. > >
