diff options
| author | Horus3 | 2014-02-24 16:42:14 +0100 |
|---|---|---|
| committer | Horus3 | 2014-02-24 16:42:14 +0100 |
| commit | 06f945f27840b53e57795dadbc38e76f7e11ab1c (patch) | |
| tree | 689d5c7f4ffa15460c7e90f47c6a7dd59ce4e8bd /zend/documentation/manual/core/en/project-structure.rewrite.html | |
| download | random-06f945f27840b53e57795dadbc38e76f7e11ab1c.tar.gz | |
init
Diffstat (limited to 'zend/documentation/manual/core/en/project-structure.rewrite.html')
| -rw-r--r-- | zend/documentation/manual/core/en/project-structure.rewrite.html | 215 |
1 files changed, 215 insertions, 0 deletions
diff --git a/zend/documentation/manual/core/en/project-structure.rewrite.html b/zend/documentation/manual/core/en/project-structure.rewrite.html new file mode 100644 index 0000000..3127eae --- /dev/null +++ b/zend/documentation/manual/core/en/project-structure.rewrite.html @@ -0,0 +1,215 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + <title>Rewrite Configuration Guide - Zend Framework Manual</title> + +</head> +<body> +<table width="100%"> + <tr valign="top"> + <td width="85%"> + <table width="100%"> + <tr> + <td width="25%" style="text-align: left;"> + <a href="project-structure.filesystem.html">Module Structure</a> + </td> + + <td width="50%" style="text-align: center;"> + <div class="up"><span class="up"><a href="project-structure.html">Recommended Project Structure for Zend Framework MVC Applications</a></span><br /> + <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> + </td> + + <td width="25%" style="text-align: right;"> + <div class="next" style="text-align: right; float: right;"><a href="performance.html">Zend Gdata Performance Guide</a></div> + </td> + </tr> + </table> +<hr /> +<div id="project-structure.rewrite" class="section"><div class="info"><h1 class="title">Rewrite Configuration Guide</h1></div> + + + <p class="para"> + <acronym class="acronym">URL</acronym> rewriting is a common function of <acronym class="acronym">HTTP</acronym> + 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. + </p> + + <div class="section" id="project-structure.rewrite.apache" name="project-structure.rewrite.apache"><div class="info"><h1 class="title">Apache HTTP Server</h1></div> + + + <p class="para"> + All examples that follow use <span class="property">mod_rewrite</span>, an official + module that comes bundled with Apache. To use it, + <span class="property">mod_rewrite</span> must either be included at compile time or + enabled as a Dynamic Shared Object (<acronym class="acronym">DSO</acronym>). Please consult the + <a href="http://httpd.apache.org/docs/" class="link external">» Apache documentation</a> for your + version for more information. + </p> + + <div class="section" id="project-structure.rewrite.apache.vhost" name="project-structure.rewrite.apache.vhost"><div class="info"><h1 class="title">Rewriting inside a VirtualHost</h1></div> + + + <p class="para"> + Here is a very basic virtual host definition. These rules direct all requests + to <var class="filename">index.php</var>, except when a matching file is found under + the <span class="property">document_root</span>. + </p> + + <div class="programlisting text"><div class="textcode"><div class="text" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><VirtualHost my.domain.com:80></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> ServerName my.domain.com</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> DocumentRoot /path/to/server/root/my.domain.com/public</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> RewriteEngine off</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <Location /></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> RewriteEngine On</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> RewriteCond %{REQUEST_FILENAME} -s [OR]</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> RewriteCond %{REQUEST_FILENAME} -l [OR]</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> RewriteCond %{REQUEST_FILENAME} -d</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> RewriteRule ^.*$ - [NC,L]</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> RewriteRule ^.*$ /index.php [NC,L]</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> </Location></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"></VirtualHost></div></li></ol></div></div></div> + + + <p class="para"> + Note the slash ("/") prefixing <var class="filename">index.php</var>; the rules for + <var class="filename">.htaccess</var> differ in this regard. + </p> + </div> + + <div class="section" id="project-structure.rewrite.apache.htaccess" name="project-structure.rewrite.apache.htaccess"><div class="info"><h1 class="title">Rewriting within a .htaccess file</h1></div> + + + <p class="para"> + Below is a sample <var class="filename">.htaccess</var> file that utilizes + <span class="property">mod_rewrite</span>. It is similar to the virtual host + configuration, except that it specifies only the rewrite rules, and the leading + slash is omitted from <var class="filename">index.php</var>. + </p> + + <div class="programlisting text"><div class="textcode"><div class="text" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteEngine On</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %{REQUEST_FILENAME} -s [OR]</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %{REQUEST_FILENAME} -l [OR]</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteCond %{REQUEST_FILENAME} -d</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteRule ^.*$ - [NC,L]</div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">RewriteRule ^.*$ index.php [NC,L]</div></li></ol></div></div></div> + + + <p class="para"> + There are many ways to configure <span class="property">mod_rewrite</span>; if you + would like more information, see Jayson Minard's <a href="http://devzone.zend.com/a/70" class="link external">» Blueprint for PHP Applications: + Bootstrapping</a>. + </p> + </div> + + </div> + + <div class="section" id="project-structure.rewrite.iis" name="project-structure.rewrite.iis"><div class="info"><h1 class="title">Microsoft Internet Information Server</h1></div> + + + <p class="para"> + As of version 7.0, <acronym class="acronym">IIS</acronym> now ships with a standard rewrite engine. + You may use the following configuration to create the appropriate rewrite rules. + </p> + + <div class="programlisting xml"><div class="xmlcode"><div class="xml" style="font-family: monospace;"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;"><?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"UTF-8"</span><span style="font-weight: bold; color: black;">?></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;"><configuration<span style="font-weight: bold; color: black;">></span></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><system</span>.webServer<span style="font-weight: bold; color: black;">></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><rewrite<span style="font-weight: bold; color: black;">></span></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><rules<span style="font-weight: bold; color: black;">></span></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><rule</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Imported Rule 1"</span> <span style="color: #000066;">stopProcessing</span>=<span style="color: #ff0000;">"true"</span><span style="font-weight: bold; color: black;">></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><match</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">"^.*$"</span> <span style="font-weight: bold; color: black;">/></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><conditions</span> <span style="color: #000066;">logicalGrouping</span>=<span style="color: #ff0000;">"MatchAny"</span><span style="font-weight: bold; color: black;">></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><add</span> <span style="color: #000066;">input</span>=<span style="color: #ff0000;">"{REQUEST_FILENAME}"</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #000066;">matchType</span>=<span style="color: #ff0000;">"IsFile"</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">""</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #000066;">ignoreCase</span>=<span style="color: #ff0000;">"false"</span> <span style="font-weight: bold; color: black;">/></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><add</span> <span style="color: #000066;">input</span>=<span style="color: #ff0000;">"{REQUEST_FILENAME}"</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #000066;">matchType</span>=<span style="color: #ff0000;">"IsDirectory"</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">""</span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #000066;">ignoreCase</span>=<span style="color: #ff0000;">"false"</span> <span style="font-weight: bold; color: black;">/></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"></conditions<span style="font-weight: bold; color: black;">></span></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><action</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"None"</span> <span style="font-weight: bold; color: black;">/></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"></rule<span style="font-weight: bold; color: black;">></span></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><rule</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Imported Rule 2"</span> <span style="color: #000066;">stopProcessing</span>=<span style="color: #ff0000;">"true"</span><span style="font-weight: bold; color: black;">></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><match</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">"^.*$"</span> <span style="font-weight: bold; color: black;">/></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"><action</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"Rewrite"</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">"index.php"</span> <span style="font-weight: bold; color: black;">/></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"></rule<span style="font-weight: bold; color: black;">></span></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"></rules<span style="font-weight: bold; color: black;">></span></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"></rewrite<span style="font-weight: bold; color: black;">></span></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"> <span style="color: #009900;"><span style="font-weight: bold; color: black;"></system</span>.webServer<span style="font-weight: bold; color: black;">></span></span></div></li> +<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;"></configuration<span style="font-weight: bold; color: black;">></span></span></span></div></li></ol></div></div></div> + + </div> + </div> + <hr /> + + <table width="100%"> + <tr> + <td width="25%" style="text-align: left;"> + <a href="project-structure.filesystem.html">Module Structure</a> + </td> + + <td width="50%" style="text-align: center;"> + <div class="up"><span class="up"><a href="project-structure.html">Recommended Project Structure for Zend Framework MVC Applications</a></span><br /> + <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div> + </td> + + <td width="25%" style="text-align: right;"> + <div class="next" style="text-align: right; float: right;"><a href="performance.html">Zend Gdata Performance Guide</a></div> + </td> + </tr> + </table> +</td> + <td style="font-size: smaller;" width="15%"> <style type="text/css"> +#leftbar { + float: left; + width: 186px; + padding: 5px; + font-size: smaller; +} +ul.toc { + margin: 0px 5px 5px 5px; + padding: 0px; +} +ul.toc li { + font-size: 85%; + margin: 1px 0 1px 1px; + padding: 1px 0 1px 11px; + list-style-type: none; + background-repeat: no-repeat; + background-position: center left; +} +ul.toc li.header { + font-size: 115%; + padding: 5px 0px 5px 11px; + border-bottom: 1px solid #cccccc; + margin-bottom: 5px; +} +ul.toc li.active { + font-weight: bold; +} +ul.toc li a { + text-decoration: none; +} +ul.toc li a:hover { + text-decoration: underline; +} +</style> + <ul class="toc"> + <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li> + <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li> + <li class="header up"><a href="project-structure.html">Recommended Project Structure for Zend Framework MVC Applications</a></li> + <li><a href="project-structure.overview.html">Overview</a></li> + <li><a href="project-structure.project.html">Recommended Project Directory Structure</a></li> + <li><a href="project-structure.filesystem.html">Module Structure</a></li> + <li class="active"><a href="project-structure.rewrite.html">Rewrite Configuration Guide</a></li> + </ul> + </td> + </tr> +</table> +</body> +</html>
\ No newline at end of file |
