Richard Knop
Richard Knop

Reputation: 83697

Zend Framework in sub directory

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]

Upvotes: 0

Views: 2091

Answers (2)

Andreas Linden
Andreas Linden

Reputation: 12721

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/');

Upvotes: 2

phpian
phpian

Reputation: 909

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

Upvotes: 0

Related Questions