diff options
Diffstat (limited to 'docs/manual/rewrite/intro.html.en')
-rw-r--r-- | docs/manual/rewrite/intro.html.en | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/docs/manual/rewrite/intro.html.en b/docs/manual/rewrite/intro.html.en index 83eeb8ed..e10c06e5 100644 --- a/docs/manual/rewrite/intro.html.en +++ b/docs/manual/rewrite/intro.html.en @@ -9,7 +9,7 @@ <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" /> -<script src="../style/scripts/prettify.js" type="text/javascript"> +<script src="../style/scripts/prettify.min.js" type="text/javascript"> </script> <link href="../images/favicon.ico" rel="shortcut icon" /></head> @@ -189,9 +189,7 @@ value. <dl> <dt>A full filesystem path to a resource</dt> <dd> -<pre class="prettyprint lang-config"> -RewriteRule ^/games /usr/local/games/web -</pre> +<pre class="prettyprint lang-config">RewriteRule ^/games /usr/local/games/web</pre> <p>This maps a request to an arbitrary location on your filesystem, much like the <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code> directive.</p> @@ -199,9 +197,7 @@ like the <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a> <dt>A web-path to a resource</dt> <dd> -<pre class="prettyprint lang-config"> -RewriteRule ^/foo$ /bar -</pre> +<pre class="prettyprint lang-config">RewriteRule ^/foo$ /bar</pre> <p>If <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> is set to <code>/usr/local/apache2/htdocs</code>, then this directive would @@ -211,9 +207,7 @@ path <code>/usr/local/apache2/htdocs/bar</code>.</p> <dt>An absolute URL</dt> <dd> -<pre class="prettyprint lang-config"> -RewriteRule ^/product/view$ http://site2.example.com/seeproduct.html [R] -</pre> +<pre class="prettyprint lang-config">RewriteRule ^/product/view$ http://site2.example.com/seeproduct.html [R]</pre> <p>This tells the client to make a new request for the specified URL.</p> </dd> @@ -222,9 +216,7 @@ RewriteRule ^/product/view$ http://site2.example.com/seeproduct.html [R] <p>The <var>Substitution</var> can also contain <em>back-references</em> to parts of the incoming URL-path matched by the <var>Pattern</var>. Consider the following:</p> -<pre class="prettyprint lang-config"> -RewriteRule ^/product/(.*)/view$ /var/web/productdb/$1 -</pre> +<pre class="prettyprint lang-config">RewriteRule ^/product/(.*)/view$ /var/web/productdb/$1</pre> <p>The variable <code>$1</code> will be replaced with whatever text was matched by the expression inside the parenthesis in @@ -246,9 +238,7 @@ application of one or more flags to the end of the rule. For example, the matching behavior of a rule can be made case-insensitive by the application of the <code>[NC]</code> flag: </p> -<pre class="prettyprint lang-config"> -RewriteRule ^puppy.html smalldog.html [NC] -</pre> +<pre class="prettyprint lang-config">RewriteRule ^puppy.html smalldog.html [NC]</pre> <p>For more details on the available flags, their meanings, and @@ -273,10 +263,8 @@ argument is a list of flags that modify how the match is evaluated.</p> <p>For example, to send all requests from a particular IP range to a different server, you could use:</p> -<pre class="prettyprint lang-config"> -RewriteCond %{REMOTE_ADDR} ^10\.2\. -RewriteRule (.*) http://intranet.example.com$1 -</pre> +<pre class="prettyprint lang-config">RewriteCond %{REMOTE_ADDR} ^10\.2\. +RewriteRule (.*) http://intranet.example.com$1</pre> <p>When more than @@ -286,11 +274,9 @@ the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">Rewrit applied. For example, to deny requests that contain the word "hack" in their query string, unless they also contain a cookie containing the word "go", you could use:</p> -<pre class="prettyprint lang-config"> -RewriteCond %{QUERY_STRING} hack +<pre class="prettyprint lang-config">RewriteCond %{QUERY_STRING} hack RewriteCond %{HTTP_COOKIE} !go -RewriteRule . - [F] -</pre> +RewriteRule . - [F]</pre> <p>Notice that the exclamation mark specifies a negative match, so the rule is only applied if the cookie does not contain "go".</p> @@ -301,10 +287,8 @@ the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">Rewrit variables <code>%1</code>, <code>%2</code>, etc. For example, this will direct the request to a different directory depending on the hostname used to access the site:</p> -<pre class="prettyprint lang-config"> -RewriteCond %{HTTP_HOST} (.*) -RewriteRule ^/(.*) /sites/%1/$1 -</pre> +<pre class="prettyprint lang-config">RewriteCond %{HTTP_HOST} (.*) +RewriteRule ^/(.*) /sites/%1/$1</pre> <p>If the request was for <code>http://example.com/foo/bar</code>, then <code>%1</code> would contain <code>example.com</code> @@ -360,7 +344,7 @@ var comments_identifier = 'http://httpd.apache.org/docs/2.4/rewrite/intro.html'; } })(window, document); //--><!]]></script></div><div id="footer"> -<p class="apache">Copyright 2013 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="apache">Copyright 2014 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- if (typeof(prettyPrint) !== 'undefined') { prettyPrint(); |