Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6477585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:57:59+00:00 2026-05-25T06:57:59+00:00

I have a Zend Framework application with a .htaccess file in the root directory,

  • 0

I have a Zend Framework application with a .htaccess file in the root directory, directing all traffic to the /public directory, where index.php resides.

This is the contents of the .htaccess:

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/(upload|img|js|css|less)/.*$
RewriteCond %{DOCUMENT_ROOT}/public/upload%{REQUEST_URI} -f
RewriteRule ^(.+\.(jpg|png|mp3))$ /public/upload%{REQUEST_URI} [NC,L]

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

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ /public/index.php [NC,L]

As you can see, there are two commented out lines.

The section, supposedly directing traffic to /public, and which works on my local servers and my shared host, seems to fail miserably on my client’s server.

So, with the two lines commented out, when I type the site’s address in the browser, I get a directory listing. When I append /public to the address, I’m taken to /public/index.php, as expected, but since the request wasn’t redirected correctly, neither are the ones to the JS and CSS files.

When I uncomment the lines, I get a 500 internal server error (index.php is not reached at all).

The other rewrites work correctly (at least as far as I can tell).

Any ideas why this would happen and how to correct this?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:58:00+00:00Added an answer on May 25, 2026 at 6:58 am

    Save yourself a lot of grief and do the following:

    1. Set the document root to the public directory.
    2. Set the rewrite rules in the VirtualHost entry or use the standard Zend Framework rewrite rules in a .htaccess file in the public directory.

    Ok, given your shared hosting constraints, try this one out…

    1. Place all the public files into your document root including the .htaccess file mentioned in step #2 above
    2. Place the rest of the folders (ie application, library) anywhere in the filesystem, preferably outside the web document root. An example might be /home/user/apps/my-app-name/
    3. Modify the index.php file with the new APPLICATION_PATH, eg

      // Define path to application directory
      defined('APPLICATION_PATH')
          || define('APPLICATION_PATH', 'home/user/apps/my-app-name/application');
      

    Now everything should “just work” and your site won’t be accessed with the word “public” in the URL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I have a PHP Web application built using Zend Framework and MVC with
I have a PHP MVC application using Zend Framework. As presented in the quickstart,
All, I have a PHP5 application written with Zend Framework and MVC style. My
I have a Zend Framework (PHP) web application that has a table with a
I am working on a Zend Framework application with PHP. I have a form
I have a php web app created with the zend framework. The document root
Zend framework i have directory tree as following with robots.txt file, but when i
I have a Zend Framework application structure as below: /application /library /Zend /Core /Filter
I'm building a web application using PHP5.3 and Zend Framework 1.9.4. i have an
My setup: Ubuntu LAMP, application built w/ zend framework My Problem: I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.