Introducción a Zend Framework

 Aprendiendo Zend Framework

Apéndice

 Referencia de Zend Framework


  • Zend_Gdata
  • Zend_Http
  • Zend_InfoCard
  • Zend_Json
  • Zend_Layout
  • Zend_Ldap
  • Zend_Loader
  • Zend_Locale
  • Zend_Log
  • Zend_Mail
  • Zend_Markup
  • Zend_Measure
  • Zend_Memory
  • Zend_Mime
  • Zend_Navigation
  • Zend_Oauth
  • Zend_OpenId
  • Zend_Paginator
  • Zend_Pdf
  • Zend_ProgressBar
  • Zend_Queue
  • Zend_Reflection
  • Zend_Registry
  • Zend_Rest

  • Zend_Search_Lucene
  • Zend_Serializer
  • Zend_Server
  • Zend_Service
  • Zend_Session
  • Zend_Soap
  • Zend_Tag
  • Zend_Test
  • Zend_Text
  • Zend_TimeSync
  • Zend_Tool
  • Zend_Tool_Framework
  • Zend_Tool_Project
  • Zend_Translate
  • Zend_Uri
  • Zend_Validate
  • Zend_Version
  • Zend_View
  • Zend_Wildfire
  • Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Traducción al 26.9% - Actualizado el 2011-11-16 - Revisión 24249 - Versión ZF 1.11.x

    E.4. Rewrite Configuration Guide

    URL rewriting is a common function of HTTP servers. However, the rules and configuration differ widely between them. Below are some common approaches across a variety of popular web servers available at the time of writing.

    E.4.1. Apache HTTP Server

    All examples that follow use mod_rewrite, an official module that comes bundled with Apache. To use it, mod_rewrite must either be included at compile time or enabled as a Dynamic Shared Object (DSO). Please consult the Apache documentation for your version for more information.

    E.4.1.1. Rewriting inside a VirtualHost

    Here is a very basic virtual host definition. These rules direct all requests to index.php, except when a matching file is found under the document_root.

    <VirtualHost my.domain.com:80>
        
    ServerName   my.domain.com
        DocumentRoot 
    /path/to/server/root/my.domain.com/public

        
    RewriteEngine off

        
    <Location />
            
    RewriteEngine On
            RewriteCond 
    %{REQUEST_FILENAME} -[OR]
            
    RewriteCond %{REQUEST_FILENAME} -[OR]
            
    RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule 
    ^.*$ - [NC,L]
            
    RewriteRule ^.*$ /index.php [NC,L]
        </
    Location>
    </
    VirtualHost>

    Note the slash ("/") prefixing index.php; the rules for .htaccess differ in this regard.

    E.4.1.2. Rewriting within a .htaccess file

    Below is a sample .htaccess file that utilizes mod_rewrite. It is similar to the virtual host configuration, except that it specifies only the rewrite rules, and the leading slash is omitted from index.php.

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

    There are many ways to configure mod_rewrite; if you would like more information, see Jayson Minard's Blueprint for PHP Applications: Bootstrapping.

    E.4.2. Microsoft Internet Information Server

    As of version 7.0, IIS now ships with a standard rewrite engine. You may use the following configuration to create the appropriate rewrite rules.

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="Imported Rule 1" stopProcessing="true">
                        <match url="^.*$" />
                        <conditions logicalGrouping="MatchAny">
                            <add input="{REQUEST_FILENAME}"
                                 matchType="IsFile" pattern=""
                                 ignoreCase="false" />
                            <add input="{REQUEST_FILENAME}"
                                 matchType="IsDirectory"
                                 pattern=""
                                 ignoreCase="false" />
                        </conditions>
                        <action type="None" />
                    </rule>
                    <rule name="Imported Rule 2" stopProcessing="true">
                        <match url="^.*$" />
                        <action type="Rewrite" url="index.php" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>
    digg delicious meneame google twitter technorati facebook

    Comentarios

    Loading...