Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Controller_Front in Subdirectory Proposal Component Proposal

Proposed Component Name Zend_Controller_Front in Subdirectory Proposal
Developer Notes in Subdirectory Proposal
Proposers Christopher Thompson
Revision 1.1 - 1 August 2006: Updated from community comments. (wiki revision: 10)

Table of Contents

1. Overview

Allow the Front Controller to be placed in a sub-directory and work with different URL styles.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • Front Controller to be placed in a sub-directory
  • Allow different URL styles

4. Dependencies on Other Framework Components

5. Theory of Operation

This change inspects the URL and removes the base part of the URL to provide a clean PATH_INFO portion to the Router/RewriteRouter. The change is the same for either Router class.

6. Milestones / Tasks

zone: Missing {zone-data:milestones}

7. Class Index

8. Use Cases

Allows URLs like the following:

An enhancements would be to allow routing based on parameters as well, such as:


9. Class Skeletons



Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Jun 21, 2006

    <p>Have you looked at the new Rerouter class? It already hanldes this by allowing the developer to define the paths</p>

    1. Jun 21, 2006

      <p>I have and have applied the patch to the new RewriteRouter class as well (they are identical in this respect). As I said they are the same. I don't know the answer to your question. Nor do I know the thinking of those working on this. I proposed this as a possible solution early on and have not seen changes that address the problem. There are several way to potentially solve this.</p>

      <p>I understand that the new RewriteRouter allows you to define routes, but I do not believe that it deals with the Front Controller being in a sub-directory. I see that they have added a "base url" to the RewriteRouter which may be a different solution to the same problem – I don't know and it would need to be set manually. </p>

      <p>The problem as I showed above is that if you put the Front Controller in a sub-directory and geive it the URL:</p>


      <p>The router take the route to be "/sub/dir/mycontroller/myaction/" and converts it to the equivalent of:</p>


  2. Jun 22, 2006

    <p>I think you need to take another look at RewriteRouter. You can easily add routes under subdirectories. Currently, you must include the subdirectory in the route, but I'm trying to talk Martel into automatically prepending _rewriteBase.</p>

  3. Jun 27, 2006

    <p>With current version of RewriteRouter you can use it within subdirectories. RewriteBase is also detected automatically so you don't need to set anything by hand.</p>

    <p>Thank you all.</p>

  4. Sep 20, 2006

    <p>Given the RewriteRouter handles subdirectories, I suspect that we should concentrate on working out the correct RewriteBase in as many webserver configs as possible. </p>

    <p>I would prefer that the calculation of RewriteBase should be done in the request object really and then use RewriteRouter's SetRewriteBase() as proposed in <a class="external-link" href=""></a>.</p>

  5. Oct 10, 2006

    <ac:macro ac:name="note"><ac:parameter ac:name="title">Zend Comment</ac:parameter><ac:rich-text-body>
    <p>Since this functionality is already present in the RewriteRouter, the proposal is no longer being considered.</p></ac:rich-text-body></ac:macro>