0

The goal is to set up a Zend application on the same domain as a static website efficiently. Currently the following is true but slow:

  • www.website.com/ redirects to www.website.com/corp/index.html
  • /admin, /login, /session resolved to /index.php where the zend application resides

I have set up redirects to www.website.com/corp/index.html in my bootstrap file, but no matter what page I visit this redirect has to occur when appropriate. It is slowing down the entire static site. Here is my virtual host httpd.conf entry which is redirecting everything to /index.php but I want to place an exception that allows access to /corp without the redirects once you are in that directory. Other simple and effective solutions are certainly welcome as well.

<VirtualHost *:18887>
   DocumentRoot c:\pathtoapp\public
   ServerName website.com

    SetEnv APPLICATION_ENV "local"
     <Directory c:\pathtoapp\public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

1 Answer 1

1

If you modify Zend Framework's .htaccess file to bypass sending anything requests to /corp/* to the front controller, you should be able to bypass this issue.

Try changing your .htaccess file in your public directory to this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} ^corp\/* [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

The first RewriteCond checks to see if the request filename matches /corp/* and if it does, bypasses the front controller and serves the request directly through Apache and your Zend Application never has to handle any of these requests.

Sign up to request clarification or add additional context in comments.

3 Comments

After testing this fully I could not get this to work properly. A guess is that when files are 404 outside the corp directory (accidental) then those requests are taking down the page. Is there a way to exclude img xml files etc?
I'm not sure I understand, what do you mean "those requests are taking down the page", and what part of it isn't fully working? I guess it is partial though?
Sorry your response was perfect, there was another issue causing a redirect. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.