Loading docs/manual/rewrite/avoid.xml +20 −14 Original line number Diff line number Diff line Loading @@ -29,14 +29,14 @@ <p>This document supplements the <module>mod_rewrite</module> <a href="../mod/mod_rewrite.html">reference documentation</a>. It describes perhaps one of the most important concepts about mod_rewrite - namely, perhaps one of the most important concepts about <module>mod_rewrite</module> - namely, when to avoid using it.</p> <p>mod_rewrite should be considered a last resort, when other <p><module>mod_rewrite</module> should be considered a last resort, when other alternatives are found wanting. Using it when there are simpler alternatives leads to configurations which are confusing, fragile, and hard to maintain. Understanding what other alternatives are available is a very important step towards mod_rewrite mastery.</p> a very important step towards <module>mod_rewrite</module> mastery.</p> <p>Note that many of these examples won't work unchanged in your particular server configuration, so it's important that you understand Loading Loading @@ -90,7 +90,9 @@ and <code>/one/three/four.html</code>.</p> <p>To redirect URLs under <code>/one</code> to <code>http://one.example.com</code>, do the following:</p> <highlight language="config">Redirect /one/ http://one.example.com/</highlight> <highlight language="config"> Redirect "/one/" "http://one.example.com/" </highlight> <p>To redirect one hostname to another, for example <code>example.com</code> to <code>www.example.com</code>, see the Loading Loading @@ -130,16 +132,18 @@ task in a <code>.htaccess</code> file instead.</p> <p>The <directive module="mod_alias">Alias</directive> directive provides mapping from a URI to a directory - usually a directory outside of your <directive module="core">DocumentRoot</directive>. Although it is possible to perform this mapping with <code>mod_rewrite</code>, <code>Alias</code> is the preferred method, for reasons of simplicity and performance.</p> is possible to perform this mapping with <module>mod_rewrite</module>, <directive module="mod_alias">Alias</directive> is the preferred method, for reasons of simplicity and performance.</p> <example><title>Using Alias</title> <highlight language="config">Alias "/cats" "/var/www/virtualhosts/felines/htdocs"</highlight> <highlight language="config"> Alias "/cats" "/var/www/virtualhosts/felines/htdocs" </highlight> </example> <p> The use of <code>mod_rewrite</code> to perform this mapping may be The use of <module>mod_rewrite</module> to perform this mapping may be appropriate when you do not have access to the server configuration files. Alias may only be used in server or virtualhost context, and not in a <code>.htaccess</code> file. Loading @@ -153,7 +157,8 @@ server.</p> <section id="vhosts"><title>Virtual Hosting</title> <p>Although it is possible to handle <a href="vhosts.html">virtual hosts with mod_rewrite</a>, it is seldom the right way. Creating individual <VirtualHost> blocks is almost always the right way to go. In the <directive module="core" type="section">VirtualHost</directive> blocks is almost always the right way to go. In the event that you have an enormous number of virtual hosts, consider using <module>mod_vhost_alias</module> to create these hosts automatically.</p> Loading @@ -173,7 +178,7 @@ seems like the right approach.</p> <section id="proxy"><title>Simple Proxying</title> <p><code>RewriteRule</code> provides the <a <p><directive module="mod_rewrite">RewriteRule</directive> provides the <a href="flags.html#flag_p">[P]</a> flag to pass rewritten URIs through <module>mod_proxy</module>.</p> Loading Loading @@ -233,7 +238,8 @@ header, response header, or environment variable, replacing <p>See especially the <a href="../expr.html">expression evaluation documentation</a> for a overview of what types of expressions you can use in <If> sections, and in certain other directives.</p> use in <directive module="core" type="section">If</directive> sections, and in certain other directives.</p> </section> Loading Loading
docs/manual/rewrite/avoid.xml +20 −14 Original line number Diff line number Diff line Loading @@ -29,14 +29,14 @@ <p>This document supplements the <module>mod_rewrite</module> <a href="../mod/mod_rewrite.html">reference documentation</a>. It describes perhaps one of the most important concepts about mod_rewrite - namely, perhaps one of the most important concepts about <module>mod_rewrite</module> - namely, when to avoid using it.</p> <p>mod_rewrite should be considered a last resort, when other <p><module>mod_rewrite</module> should be considered a last resort, when other alternatives are found wanting. Using it when there are simpler alternatives leads to configurations which are confusing, fragile, and hard to maintain. Understanding what other alternatives are available is a very important step towards mod_rewrite mastery.</p> a very important step towards <module>mod_rewrite</module> mastery.</p> <p>Note that many of these examples won't work unchanged in your particular server configuration, so it's important that you understand Loading Loading @@ -90,7 +90,9 @@ and <code>/one/three/four.html</code>.</p> <p>To redirect URLs under <code>/one</code> to <code>http://one.example.com</code>, do the following:</p> <highlight language="config">Redirect /one/ http://one.example.com/</highlight> <highlight language="config"> Redirect "/one/" "http://one.example.com/" </highlight> <p>To redirect one hostname to another, for example <code>example.com</code> to <code>www.example.com</code>, see the Loading Loading @@ -130,16 +132,18 @@ task in a <code>.htaccess</code> file instead.</p> <p>The <directive module="mod_alias">Alias</directive> directive provides mapping from a URI to a directory - usually a directory outside of your <directive module="core">DocumentRoot</directive>. Although it is possible to perform this mapping with <code>mod_rewrite</code>, <code>Alias</code> is the preferred method, for reasons of simplicity and performance.</p> is possible to perform this mapping with <module>mod_rewrite</module>, <directive module="mod_alias">Alias</directive> is the preferred method, for reasons of simplicity and performance.</p> <example><title>Using Alias</title> <highlight language="config">Alias "/cats" "/var/www/virtualhosts/felines/htdocs"</highlight> <highlight language="config"> Alias "/cats" "/var/www/virtualhosts/felines/htdocs" </highlight> </example> <p> The use of <code>mod_rewrite</code> to perform this mapping may be The use of <module>mod_rewrite</module> to perform this mapping may be appropriate when you do not have access to the server configuration files. Alias may only be used in server or virtualhost context, and not in a <code>.htaccess</code> file. Loading @@ -153,7 +157,8 @@ server.</p> <section id="vhosts"><title>Virtual Hosting</title> <p>Although it is possible to handle <a href="vhosts.html">virtual hosts with mod_rewrite</a>, it is seldom the right way. Creating individual <VirtualHost> blocks is almost always the right way to go. In the <directive module="core" type="section">VirtualHost</directive> blocks is almost always the right way to go. In the event that you have an enormous number of virtual hosts, consider using <module>mod_vhost_alias</module> to create these hosts automatically.</p> Loading @@ -173,7 +178,7 @@ seems like the right approach.</p> <section id="proxy"><title>Simple Proxying</title> <p><code>RewriteRule</code> provides the <a <p><directive module="mod_rewrite">RewriteRule</directive> provides the <a href="flags.html#flag_p">[P]</a> flag to pass rewritten URIs through <module>mod_proxy</module>.</p> Loading Loading @@ -233,7 +238,8 @@ header, response header, or environment variable, replacing <p>See especially the <a href="../expr.html">expression evaluation documentation</a> for a overview of what types of expressions you can use in <If> sections, and in certain other directives.</p> use in <directive module="core" type="section">If</directive> sections, and in certain other directives.</p> </section> Loading