Mercurial > hg > nginx-site
diff xml/en/docs/http/converting_rewrite_rules.xml @ 107:ee725af08951
Two unrelated changes were erroneously committed simultaneously:
- Making the rest of HTML valid.
- Updating the "Converting rewrite rules" howto examples to utilize
the new power of the "return" directive.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Wed, 19 Oct 2011 12:39:11 +0000 |
parents | d1e8781b9c5f |
children | 49443032011c |
line wrap: on
line diff
--- a/xml/en/docs/http/converting_rewrite_rules.xml Wed Oct 19 10:39:49 2011 +0000 +++ b/xml/en/docs/http/converting_rewrite_rules.xml Wed Oct 19 12:39:11 2011 +0000 @@ -32,14 +32,14 @@ </para> <para> -This is a wrong, cumbersome, and ineffective way. +This is a wrong, cumbersome, and ineffective way. The right way is to define a separate server for <url>nginx.org</url>: <programlisting> server { listen 80; server_name nginx.org; - rewrite ^ http://www.nginx.org$request_uri?; + return 301 http://www.nginx.org$request_uri; } server { @@ -48,6 +48,14 @@ ... } </programlisting> + +<note> +On versions prior to 0.9.1, redirects can be made with: +<programlisting> + rewrite ^ http://www.nginx.org$request_uri?; +</programlisting> +</note> + </para> </section> @@ -72,16 +80,24 @@ <programlisting> server { listen 80; - server_name nginx.com www.nginx.com; + server_name nginx.com www.nginx.com; ... } server { listen 80 default_server; server_name _; - rewrite ^ http://nginx.com$request_uri?; + return 301 http://nginx.com$request_uri; } </programlisting> + +<note> +On versions prior to 0.9.1, redirects can be made with: +<programlisting> + rewrite ^ http://nginx.com$request_uri?; +</programlisting> +</note> + </para> </section>