views:

29

answers:

2

Hello,

I would like to set up a Zend Framework project in a subdirectory:

/public_html
    /public_html/here_i_want_to_setup_zf

Document root is /public_html. I would like the Zend Framework project to be accessible via URI like this:

http://example.com/here_i_want_to_setup_zf

How should I edit my htaccess file?

RewriteEngine On

# Exclude some directories from URI rewriting
#RewriteRule ^(dir1|dir2|dir3) - [L]

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.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: 

I think to implement this you need your index.php file and .htaccess files at root directory of zend framework.

public html/name to your sub directory and now in your sub directory have following structure.

/index.php

/.htaccess

/library

/application

/public

Acharya
+1  A: 

dont touch htaccess or folder structure! simply do the following on a central spot

Zend_Controller_Front::getInstance()
    ->getRequest()
    ->setBaseUrl('/here_i_want_to_setup_zf/');
zolex