From 06f945f27840b53e57795dadbc38e76f7e11ab1c Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 24 Feb 2014 16:42:14 +0100 Subject: init --- .../manual/core/en/project-structure.rewrite.html | 215 +++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 zend/documentation/manual/core/en/project-structure.rewrite.html (limited to 'zend/documentation/manual/core/en/project-structure.rewrite.html') 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 @@ + + + + + Rewrite Configuration Guide - Zend Framework Manual + + + + + + + + +
+ + + + + + + + +
+ Module Structure + + + + +
+
+

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. +

+ +

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. +

+ +

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. +

+ +
  1. <VirtualHost my.domain.com:80>
  2. +
  3.     ServerName   my.domain.com
  4. +
  5.     DocumentRoot /path/to/server/root/my.domain.com/public
  6. +
  7.  
  8. +
  9.     RewriteEngine off
  10. +
  11.  
  12. +
  13.     <Location />
  14. +
  15.         RewriteEngine On
  16. +
  17.         RewriteCond %{REQUEST_FILENAME} -s [OR]
  18. +
  19.         RewriteCond %{REQUEST_FILENAME} -l [OR]
  20. +
  21.         RewriteCond %{REQUEST_FILENAME} -d
  22. +
  23.         RewriteRule ^.*$ - [NC,L]
  24. +
  25.         RewriteRule ^.*$ /index.php [NC,L]
  26. +
  27.     </Location>
  28. +
  29. </VirtualHost>
+ + +

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

+
+ +

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. +

+ +
  1. RewriteEngine On
  2. +
  3. RewriteCond %{REQUEST_FILENAME} -s [OR]
  4. +
  5. RewriteCond %{REQUEST_FILENAME} -l [OR]
  6. +
  7. RewriteCond %{REQUEST_FILENAME} -d
  8. +
  9. RewriteRule ^.*$ - [NC,L]
  10. +
  11. 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. +

+
+ +
+ +

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. +

+ +
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. +
  3. <configuration>
  4. +
  5.     <system.webServer>
  6. +
  7.         <rewrite>
  8. +
  9.             <rules>
  10. +
  11.                 <rule name="Imported Rule 1" stopProcessing="true">
  12. +
  13.                     <match url="^.*$" />
  14. +
  15.                     <conditions logicalGrouping="MatchAny">
  16. +
  17.                         <add input="{REQUEST_FILENAME}"
  18. +
  19.                              matchType="IsFile" pattern=""
  20. +
  21.                              ignoreCase="false" />
  22. +
  23.                         <add input="{REQUEST_FILENAME}"
  24. +
  25.                              matchType="IsDirectory"
  26. +
  27.                              pattern=""
  28. +
  29.                              ignoreCase="false" />
  30. +
  31.                     </conditions>
  32. +
  33.                     <action type="None" />
  34. +
  35.                 </rule>
  36. +
  37.                 <rule name="Imported Rule 2" stopProcessing="true">
  38. +
  39.                     <match url="^.*$" />
  40. +
  41.                     <action type="Rewrite" url="index.php" />
  42. +
  43.                 </rule>
  44. +
  45.             </rules>
  46. +
  47.         </rewrite>
  48. +
  49.     </system.webServer>
  50. +
  51. </configuration>
+ +
+
+
+ + + + + + + + + +
+ Module Structure + + + + +
+
+ +
+ + \ No newline at end of file -- cgit v1.2.3