Drue Spackman
Drue Spackman

Reputation: 13

Adding another subdirectory based application to a Zend Framework subdirectory based application

I have a php web app created with the zend framework. The document root is public_html and the hosting provider will not let me change it to the public_html/public subdirectory. That wasn't a problem as I found the following .htaccess file which allowed my app to work with the following directory layout:

public_html/public
public_html/application
public_html/application/controllers

etc..

RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,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]

Now I have a new requirement that I need to run another web app from a different subdirectory under public_html for the same domain, lets call it other, i.e. public_html/other

I've tried modifying the .htaccess file to redirect any requests containing "other" to the public_html/other subdirectory, but it always results in a 500 system error, for example if I add:

RewriteCond %{REQUEST_URI} !^/other/.*$
RewriteRule ^(.*)$ /other/$1

Everything breaks and all requests result in a 500 system error. Any suggestion on how to craft the rewrite rules to make this happen?

Upvotes: 1

Views: 345

Answers (1)

KingCrunch
KingCrunch

Reputation: 132011

RewriteRule ^other - [L]

should do it.

Upvotes: 1

Related Questions