Search code examples
.htaccesszend-frameworkframeworksforummybb

Running myBB forum within Zend Framework


I have a simple Zend Framework site I am developing with the addition that there is a myBB forum for the same site.

I placed the forum (In a folder called 'forum' within the public folder of the Zend scaffolding but issues are created in that the .htaccess that controls the URL rewrite causes issues for the forum.

I then placed the forum outside of the public folder. This works fine only if I remove the .htaccess, but then Zend obviously doesn't work.

How can I get the .htaccess rewrite to work such that if the url http://www.mysite.com/forum is used it wont rewrite the url for the Zend Framework, anything else and it should forward to the public folder.

My webroot .htaccess code is:

RewriteEngine On

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]

TIA John


Solution

  • .htaccess amended as follows:

    Options +FollowSymLinks
    RewriteEngine On
    
    RewriteRule ^\.htaccess$ - [F]
    
    RewriteRule ^(forum)($|/) - [L]
    
    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]